Esempio n. 1
0
        string ProcessCssFile(string file, string outputFile, bool asImport = false)
        {
            string css = null;

            if (file.ToLower().EndsWith(".less") || file.ToLower().EndsWith(".less.css"))
            {
                css = ProcessLess(file);
            }
            else
            {
                css = ReadFile(file);
            }

            if (ShouldImport)
            {
                css = ProcessImport(file, outputFile, css);
            }

            ICssAssetsFileHasher fileHasher = null;

            if (ShouldAppendHashForAssets)
            {
                var fileResolver = new FileSystemResolver();
                fileHasher = new CssAssetsFileHasher(HashKeyName, fileResolver, hasher);
            }

            return(CSSPathRewriter.RewriteCssPaths(outputFile, file, css, fileHasher, asImport));
        }
Esempio n. 2
0
        string ProcessCssFile(string file, string outputFile, bool asImport = false)
        {
            string css = null;

            var preprocessors = FindPreprocessors(file);

            if (preprocessors != null)
            {
                css = PreprocessFile(file, preprocessors);
            }
            else
            {
                css = ReadFile(file);
            }

            if (ShouldImport)
            {
                css = ProcessImport(file, outputFile, css);
            }

            ICssAssetsFileHasher fileHasher = null;

            if (ShouldAppendHashForAssets)
            {
                var fileResolver = new FileSystemResolver();
                fileHasher = new CssAssetsFileHasher(bundleState.HashKeyName, fileResolver, hasher);
            }

            return(CSSPathRewriter.RewriteCssPaths(outputFile, file, css, fileHasher, asImport));
        }