Example #1
0
        private static void applyBatchedNonGlobalTransforms(ContentPlan plan, TransformerRequirements requirements)
        {
            var policy = findBatchedTransformerPolicy(requirements);

            if (policy == null)
            {
                return;
            }


            var groups = new AssetGrouper <IContentSource>()
                         .GroupSubjects(plan.GetAllSources(), source => requirements.IsNextPolicy(source, policy));

            groups.Each(group =>
            {
                if (group.Count == 1)
                {
                    plan.ApplyTransform(group.Single(), policy.TransformerType);
                }
                else
                {
                    var combo = plan.Combine(group);
                    plan.ApplyTransform(combo, policy.TransformerType);
                }

                group.Each(s => requirements.DequeueTransformer(s, policy));
            });
        }
        private void applyGlobalTransforms(ContentPlan plan)
        {
            var globalPolicies = _library.FindGlobalPoliciesFor(plan.MimeType);
            globalPolicies.Each(policy =>
            {
                if (policy.MustBeBatched())
                {
                    plan.CombineAll();
                }

                plan.GetAllSources().Each(s => plan.ApplyTransform(s, policy.TransformerType));
            });
        }
Example #3
0
        private void applyGlobalTransforms(ContentPlan plan)
        {
            var globalPolicies = _library.FindGlobalPoliciesFor(plan.MimeType);
            globalPolicies.Each(policy =>
            {
                if (policy.MustBeBatched())
                {
                    plan.CombineAll();
                }

                plan.GetAllSources().Each(s => plan.ApplyTransform(s, policy.TransformerType));
            });
        }
        private static void applyBatchedNonGlobalTransforms(ContentPlan plan, TransformerRequirements requirements)
        {
            var policy = findBatchedTransformerPolicy(requirements);
            if (policy == null) return;


            var groups = new AssetGrouper<IContentSource>()
                .GroupSubjects(plan.GetAllSources(), source => requirements.IsNextPolicy(source, policy));

            groups.Each(group =>
            {
                if (group.Count == 1)
                {
                    plan.ApplyTransform(group.Single(), policy.TransformerType);
                }
                else
                {
                    var combo = plan.Combine(group);
                    plan.ApplyTransform(combo, policy.TransformerType);
                }

                group.Each(s => requirements.DequeueTransformer(s, policy));
            });
        }
Example #5
0
        private static void applyNonBatchedNonGlobalTransforms(IEnumerable<AssetFile> files, ContentPlan plan,
                                                               TransformerRequirements requirements)
        {
            foreach (var file in files)
            {
                var source = plan.FindForFile(file);
                var policies = requirements.PoliciesFor(file);

                while (policies.Any() && !policies.Peek().MustBeBatched())
                {
                    var policy = policies.Dequeue();
                    source = plan.ApplyTransform(source, policy.TransformerType);
                }
            }
        }
        private static void applyNonBatchedNonGlobalTransforms(IEnumerable<AssetFile> files, ContentPlan plan,
                                                               TransformerRequirements requirements)
        {
            foreach (var file in files)
            {
                var source = plan.FindForFile(file);
                var policies = requirements.PoliciesFor(file);

                while (policies.Any() && !policies.Peek().MustBeBatched())
                {
                    var policy = policies.Dequeue();
                    source = plan.ApplyTransform(source, policy.TransformerType);
                }
            }
        }
Example #7
0
        public void SetUp()
        {
            files = new AssetFile[]{
                new AssetFile("something.js"){FullPath = "something.js"},
                new AssetFile("something2.js"){FullPath = "something2.js"},
                new AssetFile("something3.js"){FullPath = "something3.js"},
                new AssetFile("something4.js"){FullPath = "something4.js"},
            };

            thePlan = new ContentPlan("a plan", files);
            theReadFileSource = thePlan.GetAllSources().ElementAt(2);
            theTransformerNode = thePlan.ApplyTransform(theReadFileSource, typeof(StubTransformer));
        }