Esempio n. 1
0
        /// <summary>
        /// Gets the dependency tree for the type of file of the given sourceFile
        /// </summary>
        /// <returns>the dependency tree</returns>
        public static Dictionary <string, Dependencies> GetDependencies(string projectRootPath,
                                                                        string sourceFile)
        {
            if (projectRootPath == null)
            {
                return(null);
            }

            var dependencyType = GetDependencyType(sourceFile);

            if (!_dependencies.ContainsKey(dependencyType))
            {
                switch (dependencyType)
                {
                case DependencyType.Sass:
                    _dependencies[dependencyType] = new SassDependencyResolver();
                    break;

                case DependencyType.Less:
                    _dependencies[dependencyType] = new LessDependencyResolver();
                    break;
                }
            }

            if (_dependencies.ContainsKey(dependencyType))
            {
                _dependencies[dependencyType].UpdateFileDependencies(sourceFile);
                return(_dependencies[dependencyType].GetDependencies(projectRootPath));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the dependency tree for the type of file of the given sourceFile
        /// </summary>
        /// <returns>the dependency tree</returns>
        public static Dictionary<string, Dependencies> GetDependencies(string projectRootPath,
                                                                       string sourceFile)
        {
            if (projectRootPath == null)
                return null;

            var dependencyType = GetDependencyType(sourceFile);

            if(!_dependencies.ContainsKey(dependencyType))
            {
                switch (dependencyType)
                {
                    case DependencyType.Sass:
                        _dependencies[dependencyType] = new SassDependencyResolver();
                        break;
                    case DependencyType.Less:
                        _dependencies[dependencyType] = new LessDependencyResolver();
                        break;
                }
            }

            if (_dependencies.ContainsKey(dependencyType))
            {
                _dependencies[dependencyType].UpdateFileDependencies(sourceFile);
                return _dependencies[dependencyType].GetDependencies(projectRootPath);
            }
            else
                return null;
        }