示例#1
0
        protected string ProcessAppendHash(Uri cssRootPathUri, string fileContents)
        {
            if (_localCssAssetFilesThatExist == null)
            {
                _localCssAssetFilesThatExist = new List <FileInfo>();
            }

            var distinctLocalPaths          = CssPathRewriter.FindDistinctLocalPaths(fileContents);
            var distinctLocalPathsThatExist = new List <Uri>();

            foreach (var distinctLocalPath in distinctLocalPaths)
            {
                var cssAssetFileInfo = new FileInfo(PathProvider.MapPath(cssRootPathUri, distinctLocalPath));

                if (!cssAssetFileInfo.Exists)
                {
                    continue;
                }

                distinctLocalPathsThatExist.Add(distinctLocalPath);
                _localCssAssetFilesThatExist.Add(cssAssetFileInfo);
            }

            return(CssPathRewriter.RewriteCssPathsToAppendHash(distinctLocalPathsThatExist, cssRootPathUri, fileContents));
        }
        public string Process(Uri cssRootPathUri, System.IO.FileInfo file, string fileContents)
        {
            if (!_appendAssetsToHash)
            {
                return(fileContents);
            }

            var distinctLocalPathsThatExist = GetCssAssets(cssRootPathUri, fileContents).Select(x => x.Url);

            return(_cssPathRewriter.RewriteCssPathsToAppendHash(distinctLocalPathsThatExist, cssRootPathUri, fileContents));
        }