示例#1
0
        public AssmanContext BuildContext(ResourceMode resourceMode, IResourceFinder fileFinder, IPreCompiledReportPersister preCompiledPersister)
        {
            var context = AssmanContext.Create(resourceMode);

            context.ConfigurationLastModified = LastModified(PathResolver);
            context.ConsolidateScripts        = Consolidate.IsTrue(resourceMode) && Scripts.Consolidate.IsTrue(resourceMode);
            context.ConsolidateStylesheets    = Consolidate.IsTrue(resourceMode) && Stylesheets.Consolidate.IsTrue(resourceMode);
            context.GZip = GZip.IsTrue(resourceMode);
            context.ManageDependencies = ManageDependencies;
            context.AddFinder(fileFinder);
            context.AddAssemblies(Assemblies.GetAssemblies());
            context.ScriptGroups.AddGlobalDependencies(Scripts.GlobalDependencies.Cast <GlobalDependenciesElement>().Select(e => e.Path));
            context.ScriptGroups.AddRange(Scripts.Groups.Cast <IResourceGroupTemplate>());
            context.StyleGroups.AddGlobalDependencies(Stylesheets.GlobalDependencies.Cast <GlobalDependenciesElement>().Select(e => e.Path));
            context.StyleGroups.AddRange(Stylesheets.Groups.Cast <IResourceGroupTemplate>());
            context.MapExtensionToContentPipeline(".js", DefaultPipelines.Javascript());
            context.MapExtensionToContentPipeline(".css", DefaultPipelines.Css());
            context.MapExtensionToDependencyProvider(".js", VisualStudioScriptDependencyProvider.GetInstance());
            context.MapExtensionToDependencyProvider(".css", CssDependencyProvider.GetInstance());

            PreCompilationReport preCompilationReport;

            if (preCompiledPersister.TryGetPreConsolidationInfo(out preCompilationReport))
            {
                context.LoadPreCompilationReport(preCompilationReport);
            }

            foreach (var plugin in Plugins.GetPlugins())
            {
                plugin.Initialize(context);
            }

            return(context);
        }
示例#2
0
 public void SetupContext()
 {
     _provider = new VisualStudioScriptDependencyProvider();
 }