예제 #1
0
        private string CompressCss(string outputFilePath, List <string> files, ICssCompressor compressor, bool appendHashToAssets)
        {
            var outputCss = new StringBuilder();

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

                if (processImports)
                {
                    css = ProcessImport(css);
                }

                ICssAssetsFileHasher fileHasher = null;

                if (appendHashToAssets)
                {
                    var fileResolver = new FileResolver();
                    fileHasher = new CssAssetsFileHasher(hashQueryStringKeyName, fileResolver, hasher);
                }

                css = CssPathRewriter.RewriteCssPaths(outputFilePath, file, css, fileHasher);
                outputCss.Append(css + "\n");
            }
            return(compressor.CompressContent(outputCss.ToString()));
        }
예제 #2
0
 public CssCompressorTask(ICssCompressor compressor)
     : base(compressor)
 {
     this.compressor = compressor;
 }
예제 #3
0
        private StringBuilder CompressCss(string outputFilePath, List<string> files, ICssCompressor compressor)
        {
            var outputCss = new StringBuilder();
            foreach (string file in files)
            {
                string css;
                if (file.ToLower().EndsWith(".less") || file.ToLower().EndsWith(".less.css"))
                {
                    css = ProcessLess(file);
                }
                else
                {
                    css = ReadFile(file);
                }

                if (processImports)
                {
                    css = ProcessImport(css);
                }
                css = CssPathRewriter.RewriteCssPaths(outputFilePath, file, css);
                outputCss.Append(compressor.CompressContent(css));
            }
            return outputCss;
        }
 public CssCompressorTask(ICssCompressor compressor)
     : base(compressor)
 {
     _compressor = compressor;
 }
 public YuiCssCompressor(ICssCompressor compressor)
 {
     _compressor = compressor;
 }
예제 #6
0
파일: CssBundle.cs 프로젝트: shawng/bundler
 private StringBuilder CompressCss(List<string> files, ICssCompressor compressor)
 {
     var outputCss = new StringBuilder();
     foreach (string file in files)
     {
         if (Path.GetExtension(file).ToLower() == ".less")
         {
             string css = ProcessLess(file);
             outputCss.Append(compressor.CompressContent(css));
         }
         else
         {
             string css = ReadFile(file);
             outputCss.Append(compressor.CompressContent(css));
         }
     }
     return outputCss;
 }
 public AssetsProvider(IConfigurationRoot config, ICssCompressor cssCompressor, IJavaScriptCompressor javaScriptCompressor)
 {
     _config               = config;
     _cssCompressor        = cssCompressor;
     _javaScriptCompressor = javaScriptCompressor;
 }
예제 #8
0
        private StringBuilder CompressCss(string outputFilePath, List <string> files, ICssCompressor compressor)
        {
            var outputCss = new StringBuilder();

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

                if (processImports)
                {
                    css = ProcessImport(css);
                }
                css = CssPathRewriter.RewriteCssPaths(outputFilePath, file, css);
                outputCss.Append(compressor.CompressContent(css));
            }
            return(outputCss);
        }
예제 #9
0
        public string CompressCss(string outputFilePath, List <string> files, string compressorType)
        {
            ICssCompressor compressor = CssCompressorRegistry.Get(compressorType);

            return(CompressCss(outputFilePath, files, compressor).ToString());
        }
 public CssBundleAdapterCompressorTask(ICssCompressor compressor)
     : base(compressor)
 {
     this._compressor = compressor;
 }
 public YuiCssCompressor(ICssCompressor compressor)
 {
     _compressor = compressor;
 }
예제 #12
0
 public ICssBundleBuilder WithCompressor(ICssCompressor cssCompressor)
 {
     this.cssCompressorInstance = cssCompressor;
     return(this);
 }
예제 #13
0
 public ICssBundleBuilder WithCompressor(CssCompressors cssCompressor)
 {
     this.cssCompressorInstance = MapCompressorEnumToType(cssCompressor);
     return(this);
 }
예제 #14
0
        private string CompressCss(string outputFilePath, List<string> files, ICssCompressor compressor, bool appendHashToAssets)
        {
            var outputCss = new StringBuilder();
            foreach (string file in files)
            {
                string css;
                if (file.ToLower().EndsWith(".less") || file.ToLower().EndsWith(".less.css"))
                {
                    css = ProcessLess(file);
                }
                else
                {
                    css = ReadFile(file);
                }

                if (processImports)
                {
                    css = ProcessImport(css);
                }

                ICssAssetsFileHasher fileHasher = null;

                if (appendHashToAssets)
                {
                    var fileResolver = new FileResolver();
                    fileHasher = new CssAssetsFileHasher(hashQueryStringKeyName, fileResolver, hasher);
                }

                css = CssPathRewriter.RewriteCssPaths(outputFilePath, file, css, fileHasher);
                outputCss.Append(css + "\n");
            }
            return compressor.CompressContent(outputCss.ToString());
        }
예제 #15
0
 public ICssBundleBuilder WithCompressor(ICssCompressor cssCompressor)
 {
     this.cssCompressorInstance = cssCompressor;
     return this;
 }
예제 #16
0
 public ICssBundleBuilder WithCompressor(CssCompressors cssCompressor)
 {
     this.cssCompressorInstance = MapCompressorEnumToType(cssCompressor);
     return this;
 }