Skip to content

CDN and Debug Mode Speed Improvements #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8e67fc3
first part of rebase
David-Durst Aug 23, 2012
33c7ca8
Cache Individual Bundles
David-Durst Aug 8, 2012
9e8805d
CDN 2
David-Durst Aug 23, 2012
1621e1a
Part of the way to disk caching
David-Durst Aug 14, 2012
a74d92c
mostly working caching
David-Durst Aug 14, 2012
77bbc07
not clean, but it works with disk caching
David-Durst Aug 15, 2012
4eff130
some cleanup
David-Durst Aug 15, 2012
cb9cd8b
more cleanup, undoing most of my previous protobufing
David-Durst Aug 15, 2012
2c7ca5b
fixed bug with templates, haven't solved ryan's bug yet
David-Durst Aug 15, 2012
f49f2a6
fixed bug with templates, haven't solved ryan's bug yet with actual f…
David-Durst Aug 15, 2012
144648c
fixed ryan's problem of cache collision
David-Durst Aug 15, 2012
b28ce15
fixed problem of htmltemplatebundle not having a renderer
David-Durst Aug 15, 2012
66a5718
added unit tests and made stuff organized into interfaces
David-Durst Aug 16, 2012
eb2f1d6
unignored the diskbackbundlecache tests
David-Durst Aug 16, 2012
995b573
moved to json from protobuf
David-Durst Aug 16, 2012
ca6f665
Change pipeline, add debughtmltemplaterenderer, add tests
David-Durst Aug 23, 2012
5df4825
cleaned up tests
David-Durst Aug 17, 2012
83548c9
changed some testing
David-Durst Aug 20, 2012
d46ac2c
fixed the files still rendering after being moved to bad places
David-Durst Aug 20, 2012
ce179e1
fixed unit tests and made cached files in directories
David-Durst Aug 21, 2012
96e2079
added locking
David-Durst Aug 21, 2012
9d2825d
here are the fixes
David-Durst Aug 22, 2012
a9a29a7
ready for a pull
David-Durst Aug 23, 2012
30b4cc7
really ready for a pull
David-Durst Aug 23, 2012
ff7d466
now always sort in one bundle
David-Durst Aug 23, 2012
9f76358
fixed filenames
David-Durst Aug 23, 2012
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions src/Cassette.Hogan/HoganPipeline.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
using System.Collections.Generic;
using Cassette.BundleProcessing;
using Cassette.Configuration;

namespace Cassette.HtmlTemplates
{
public class HoganPipeline : MutablePipeline<HtmlTemplateBundle>
using System.Collections.Generic;
using Cassette.BundleProcessing;
using Cassette.Configuration;
namespace Cassette.HtmlTemplates
{
public class HoganPipeline : MutablePipeline<HtmlTemplateBundle>
{
/// <summary>
/// The name of the JavaScript variable to store compiled templates in.
/// For example, the default is "JST", so a template will be registered as <code>JST['my-template'] = ...;</code>.
/// </summary>
public string JavaScriptVariableName { get; set; }

protected override IEnumerable<IBundleProcessor<HtmlTemplateBundle>> CreatePipeline(HtmlTemplateBundle bundle, CassetteSettings settings)
{
yield return new AssignHtmlTemplateRenderer(
new RemoteHtmlTemplateBundleRenderer(settings.UrlGenerator)
);
yield return new AssignContentType("text/javascript");
yield return new ParseHtmlTemplateReferences();
public string JavaScriptVariableName { get; set; }
protected override IEnumerable<IBundleProcessor<HtmlTemplateBundle>> CreatePipeline(HtmlTemplateBundle bundle, CassetteSettings settings)
{
yield return new AssignHtmlTemplateRenderer(
new RemoteHtmlTemplateBundleRenderer(settings.UrlGenerator)
);
yield return new AssignContentType("text/javascript");
yield return new ParseHtmlTemplateReferences();
yield return new CompileHogan();
yield return new RegisterTemplatesWithHogan(bundle, JavaScriptVariableName);
yield return new AssignHash();
yield return new ConcatenateAssets();
}
}
if (!settings.IsDebuggingEnabled)
{
yield return new ConcatenateAssets();
}
}
}
}
5 changes: 4 additions & 1 deletion src/Cassette.JQueryTmpl/JQueryTmplPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ protected override IEnumerable<IBundleProcessor<HtmlTemplateBundle>> CreatePipel
yield return new CompileJQueryTmpl();
yield return new RegisterTemplatesWithJQueryTmpl(bundle);
yield return new AssignHash();
yield return new ConcatenateAssets();
if (!settings.IsDebuggingEnabled)
{
yield return new ConcatenateAssets();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ protected override IEnumerable<IBundleProcessor<HtmlTemplateBundle>> CreatePipel
yield return new CompileKnockoutJQueryTmpl();
yield return new RegisterTemplatesWithJQueryTmpl(bundle);
yield return new AssignHash();
yield return new ConcatenateAssets();
if (!settings.IsDebuggingEnabled)
{
yield return new ConcatenateAssets();
}
}
}
}
7 changes: 6 additions & 1 deletion src/Cassette.MSBuild/UrlPlaceholderWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ namespace Cassette.MSBuild
{
class UrlPlaceholderWrapper : IUrlModifier
{
public string Modify(string url)
public string PreCacheModify(string url)
{
return "<CASSETTE_URL_ROOT>" + url + "</CASSETTE_URL_ROOT>";
}

public string PostCacheModify(string url)
{
return PreCacheModify(url);
}
}
}
1 change: 1 addition & 0 deletions src/Cassette.UnitTests/Cassette.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<Compile Include="Configuration\BundleCollection.AddUrl.cs" />
<Compile Include="Configuration\BundleCollection.AddPerIndividualFile.cs" />
<Compile Include="Configuration\CassetteSettings.cs" />
<Compile Include="Configuration\DiskBackedBundleCache.cs" />
<Compile Include="ConstantHtmlRenderer.cs" />
<Compile Include="HtmlTemplates\InlineHtmlTemplateRenderer.cs" />
<Compile Include="Manifests\AssetManifest.cs" />
Expand Down
11 changes: 11 additions & 0 deletions src/Cassette.UnitTests/Configuration/BundleContainerFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using Xunit;

namespace Cassette.Configuration
{
Expand All @@ -8,5 +9,15 @@ internal override IBundleContainerFactory CreateFactory(IEnumerable<Bundle> bund
{
return new BundleContainerFactory(new BundleCollection(Settings, bundles), Settings);
}

[Fact]
public void GivenHtmlTemplateBundleWithNoAssets_DontCrashOnRender()
{
var bundle = new HtmlTemplates.HtmlTemplateBundle("testPath");
Settings.IsDebuggingEnabled = true;
var containerFactory = CreateFactory(new[] { bundle });
var container = containerFactory.CreateBundleContainer();
bundle.Render();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,7 @@ public void GivenAssetWithAdHocUrlReference_WhenCreate_ThenExternalBundleIsCreat

externalBundle.WasProcessed.ShouldBeTrue();
}


}
}
Loading