Пример #1
0
        public void Configure(ModuleConfiguration modules, ICassetteApplication application)
        {
            modules.Add(
                new PerSubDirectorySource<ScriptModule>("Scripts")
                {
                    FilePattern = "*.js",
                    Exclude = new Regex("-vsdoc\\.js$")
                },
                new ExternalScriptModule("twitter", "http://platform.twitter.com/widgets.js")
                {
                    Location = "body"
                }
            );

            modules.Add(new DirectorySource<StylesheetModule>("Styles")
            {
                FilePattern = "*.css;*.less",
                CustomizeModule = module => module.Processor = new StylesheetPipeline
                {
                    CompileLess = true,
                    ConvertImageUrlsToDataUris = true
                }
            });

            modules.Add(new PerSubDirectorySource<HtmlTemplateModule>("HtmlTemplates")
            {
                CustomizeModule = module => module.Processor = new KnockoutJQueryTmplPipeline()
            });
        }
Пример #2
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(new DirectorySource<StylesheetModule>("assets/styles")
     {
         FilePattern = "*.css"
     });
 }
Пример #3
0
 public BundleConfiguration(ICassetteApplication application, IDirectory cacheDirectory, IDirectory sourceDirectory, Dictionary <Type, object> bundleFactories, string version)
 {
     this.application     = application;
     this.cacheDirectory  = cacheDirectory;
     this.sourceDirectory = sourceDirectory;
     this.bundleFactories = bundleFactories;
     this.version         = version;
 }
Пример #4
0
        public ModuleSourceTestBase()
        {
            root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            Directory.CreateDirectory(root);

            application = StubApplication();
            moduleFactory = StubModuleFactory();
        }
Пример #5
0
        public IEnumerable <T> GetBundles(IBundleFactory <T> bundleFactory, ICassetteApplication application)
        {
            var directory = GetDirectoryForBasePath(application);
            var filenames = GetFilenames(directory);

            return(from filename in filenames
                   select CreateBundle(filename, bundleFactory, directory));
        }
Пример #6
0
        public BundleRequestHandler(ICassetteApplication application, RequestContext requestContext)
        {
            this.application = application;

            routeData   = requestContext.RouteData;
            response    = requestContext.HttpContext.Response;
            request     = requestContext.HttpContext.Request;
            httpContext = requestContext.HttpContext;
        }
Пример #7
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(new ExternalScriptModule("jquery", "//ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"));
     moduleConfiguration.Add(new PerSubDirectorySource<ScriptModule>("assets/scripts"));
     moduleConfiguration.Add(new DirectorySource<StylesheetModule>("assets/styles")
     {
         FilePattern = "*.css"
     });
 }
Пример #8
0
        public IEnumerable <T> GetBundles(IBundleFactory <T> bundleFactory, ICassetteApplication application)
        {
            var root = application.RootDirectory;

            var bundles = (
                from subDirectoryName in GetBundleDirectoryPaths(application)
                where IsNotHidden(root, subDirectoryName)
                select CreateBundle(
                    subDirectoryName,
                    root.GetDirectory(subDirectoryName.Substring(2), false),
                    bundleFactory
                    )
                ).ToArray();

            CustomizeBundles(bundles);
            return(bundles);
        }
Пример #9
0
 protected override IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application)
 {
     return(application.RootDirectory.GetDirectoryPaths(baseDirectory).Select(EnsureApplicationRelativePath));
 }
Пример #10
0
 public override IHtmlString Render(ICassetteApplication application)
 {
     return Renderer.Render(this);
 }
Пример #11
0
 public override void Process(ICassetteApplication application)
 {
     Processor.Process(this, application);
 }
Пример #12
0
 IDirectory GetDirectoryForBasePath(ICassetteApplication application)
 {
     return(basePath.Length == 1
                ? application.RootDirectory
                : application.RootDirectory.GetDirectory(basePath.Substring(2), false));
 }
Пример #13
0
        public ReferenceBuilder_Render_Tests()
        {
            bundleContainer = new Mock<IBundleContainer>();
            placeholderTracker = new Mock<IPlaceholderTracker>();
            application = Mock.Of<ICassetteApplication>();
            bundleFactories = new Dictionary<Type, IBundleFactory<Bundle>>();

            bundleContainer.Setup(c => c.IncludeReferencesAndSortBundles(It.IsAny<IEnumerable<Bundle>>()))
                           .Returns<IEnumerable<Bundle>>(ms => ms);

            placeholderTracker.Setup(t => t.InsertPlaceholder(It.IsAny<Func<string>>()))
                              .Returns(("output"));

            referenceBuilder = new ReferenceBuilder(bundleContainer.Object, bundleFactories, placeholderTracker.Object, new CassetteSettings());
        }
Пример #14
0
 protected abstract IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application);
Пример #15
0
        public ReferenceBuilder_Render_Tests()
        {
            moduleContainer = new Mock<IModuleContainer<Module>>();
            moduleFactory = new Mock<IModuleFactory<Module>>();
            placeholderTracker = new Mock<IPlaceholderTracker>();
            application = Mock.Of<ICassetteApplication>();
            referenceBuilder = new ReferenceBuilder<Module>(moduleContainer.Object, moduleFactory.Object, placeholderTracker.Object, application);

            moduleContainer.Setup(c => c.IncludeReferencesAndSortModules(It.IsAny<IEnumerable<Module>>()))
                           .Returns<IEnumerable<Module>>(ms => ms);

            placeholderTracker.Setup(t => t.InsertPlaceholder(It.IsAny<Func<IHtmlString>>()))
                              .Returns(new HtmlString("output"));
        }
Пример #16
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(Mock.Of<IModuleSource<ScriptModule>>());
     moduleConfiguration.Add(Mock.Of<IModuleSource<StylesheetModule>>());
     moduleConfiguration.Add(Mock.Of<IModuleSource<HtmlTemplateModule>>());
 }
Пример #17
0
 protected override IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application)
 {
     return(relativeDirectoryPaths);
 }
 public ExpandCssUrlsAssetTransformer(ICassetteApplication application)
 {
     this.application = application;
 }