Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            var file = new AssetFile("something.a.b.c.d.js");

            theComparer = new TransformerComparer(file);

            generate = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate);

            generate2 = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate);

            generate3 = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate);

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

            generateB = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate, ".b");

            generateC = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate, ".c");

            substitution = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Substitution);

            _transformer = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Transformation);

            batched = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.BatchedTransformation);

            global = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Global);
        }
Exemplo n.º 3
0
        public void return_zero_for_ordering_if_there_is_no_possible_way_to_sort()
        {
            var generate4 = JavascriptTransformerPolicy <StubTransformer> .For(ActionType.Generate, ".4");

            var comparer = new TransformerComparer(new AssetFile("something.js"));

            comparer.Compare(generate, generate4).ShouldEqual(0);
            comparer.Compare(generate4, generate).ShouldEqual(0);
        }
Exemplo n.º 4
0
        public void Configure(FubuRegistry registry)
        {
            var minifierPolicy = JavascriptTransformerPolicy <MinifierTransformer>
                                 .For(ActionType.Transformation, MimeType.Javascript.DefaultExtension());

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

            registry.Services(s =>
            {
                s.AddService <ITransformerPolicy>(minifierPolicy);
                s.SetServiceIfNone <IMinifier, UglifyMinifier>();
            });
        }
Exemplo n.º 5
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);
            });
        }