Created
March 20, 2012 22:02
-
-
Save emiaj/2141737 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyOwnPolicy : IAssetPolicy | |
| { | |
| private readonly IAssetTagPlanCache _planCache; | |
| private readonly IAssetDependencyFinder _finder; | |
| public MyOwnPolicy(IAssetTagPlanCache planCache, IAssetDependencyFinder finder) | |
| { | |
| _planCache = planCache; | |
| _finder = finder; | |
| } | |
| public void Apply(IPackageLog log, IAssetPipeline pipeline, AssetGraph graph) | |
| { | |
| WarmUp(new[]{"pageX-styles","a-single-style.css","other-style-set-for-pageX"}); | |
| WarmUp(new[]{"pageX-scripts","a-single-script.js","other-script-set-for-pageX"}); | |
| } | |
| public void WarmUp(string[] names) | |
| { | |
| var dependencies = _finder.CompileDependenciesAndOrder(names).ToList(); | |
| if (dependencies.Count == 0) | |
| { | |
| return; | |
| } | |
| var mimeType = MimeType.MimeTypeByFileName(dependencies[0]); | |
| _planCache.PlanFor(mimeType, dependencies); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment