Пример #1
0
        public void SetUp()
        {
            globalJS = new JavascriptTransformerPolicy <StubTransformer>(ActionType.Global);
            js1      = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Transformation, ".coffee");

            js2 = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Transformation, ".tr1", "tr2");

            js3 = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate, ".a");


            globalCSS = new CssTransformerPolicy <StubTransformer>(ActionType.Global);
            css1      = new CssTransformerPolicy <StubTransformer>(ActionType.Transformation, ".css");
            less      = new CssTransformerPolicy <StubTransformer>(ActionType.Transformation, ".less");
            sass      = new CssTransformerPolicy <StubTransformer>(ActionType.Transformation, ".sass");

            var policies = new List <ITransformerPolicy>()
            {
                globalJS,
                js1,
                js2,
                js3,
                globalCSS,
                css1,
                less,
                sass,
            };

            theLibrary = new TransformerPolicyLibrary(policies);
        }
        public void SetUp()
        {
            globalJS = new JavascriptTransformerPolicy<StubTransformer>(ActionType.Global);
            js1 = JavascriptTransformerPolicy<StubTransformer>.For(ActionType.Transformation, ".coffee");
            js2 = JavascriptTransformerPolicy<StubTransformer>.For(ActionType.Transformation, ".tr1", "tr2");
            js3 = JavascriptTransformerPolicy<StubTransformer>.For(ActionType.Generate, ".a");

            globalCSS = new CssTransformerPolicy<StubTransformer>(ActionType.Global);
            css1 = new CssTransformerPolicy<StubTransformer>(ActionType.Transformation, ".css");
            less = new CssTransformerPolicy<StubTransformer>(ActionType.Transformation, ".less");
            sass = new CssTransformerPolicy<StubTransformer>(ActionType.Transformation, ".sass");

            var policies = new List<ITransformerPolicy>(){
                globalJS,
                js1,
                js2,
                js3,
                globalCSS,
                css1,
                less,
                sass,
            };

            theLibrary = new TransformerPolicyLibrary(policies);
        }
        public void Configure(FubuRegistry registry)
        {
            var cssPolicy = new CssTransformerPolicy<YuiCssCompressor>(ActionType.Global);
            cssPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            var jsPolicy = JavascriptTransformerPolicy<YuiJavascriptCompressor>
                .For(ActionType.Global);

            jsPolicy.AddMatchingCriteria(file => file.MimeType == MimeType.Javascript);
            jsPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            registry.Services(x =>
            {
                x.SetServiceIfNone<IJavaScriptCompressor, JavaScriptCompressor>();
                x.SetServiceIfNone<ICssCompressor, CssCompressor>();

                x.AddService<ITransformerPolicy>(cssPolicy);
                x.AddService<ITransformerPolicy>(jsPolicy);
            });    
        }
Пример #4
0
        public void Configure(FubuRegistry registry)
        {
            var cssPolicy = new CssTransformerPolicy <YuiCssCompressor>(ActionType.Global);

            cssPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            var jsPolicy = JavascriptTransformerPolicy <YuiJavascriptCompressor>
                           .For(ActionType.Global);

            jsPolicy.AddMatchingCriteria(file => file.MimeType == MimeType.Javascript);
            jsPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            registry.Services(x =>
            {
                x.SetServiceIfNone <IJavaScriptCompressor, JavaScriptCompressor>();
                x.SetServiceIfNone <ICssCompressor, CssCompressor>();

                x.AddService <ITransformerPolicy>(cssPolicy);
                x.AddService <ITransformerPolicy>(jsPolicy);
            });
        }
Пример #5
0
        void IContentPlanScenario.CssTransformer <T>(ActionType action, params string[] extensions)
        {
            var policy = new CssTransformerPolicy <T>(action, extensions);

            _policies.Add(policy);
        }