Ejemplo n.º 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()
            });
        }
Ejemplo n.º 2
0
 public void Configure(ModuleConfiguration moduleConfiguration, ICassetteApplication application)
 {
     moduleConfiguration.Add(new DirectorySource<StylesheetModule>("assets/styles")
     {
         FilePattern = "*.css"
     });
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
0
        public ModuleSourceTestBase()
        {
            root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            Directory.CreateDirectory(root);

            application = StubApplication();
            moduleFactory = StubModuleFactory();
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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"
     });
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 9
0
 protected override IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application)
 {
     return(application.RootDirectory.GetDirectoryPaths(baseDirectory).Select(EnsureApplicationRelativePath));
 }
Ejemplo n.º 10
0
 public override IHtmlString Render(ICassetteApplication application)
 {
     return Renderer.Render(this);
 }
Ejemplo n.º 11
0
 public override void Process(ICassetteApplication application)
 {
     Processor.Process(this, application);
 }
Ejemplo n.º 12
0
 IDirectory GetDirectoryForBasePath(ICassetteApplication application)
 {
     return(basePath.Length == 1
                ? application.RootDirectory
                : application.RootDirectory.GetDirectory(basePath.Substring(2), false));
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 14
0
 protected abstract IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application);
Ejemplo n.º 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"));
        }
Ejemplo n.º 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>>());
 }
Ejemplo n.º 17
0
 protected override IEnumerable <string> GetBundleDirectoryPaths(ICassetteApplication application)
 {
     return(relativeDirectoryPaths);
 }
 public ExpandCssUrlsAssetTransformer(ICassetteApplication application)
 {
     this.application = application;
 }