本文整理汇总了C#中Cassette.Stylesheets.StylesheetBundle类的典型用法代码示例。如果您正苦于以下问题:C# StylesheetBundle类的具体用法?C# StylesheetBundle怎么用?C# StylesheetBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StylesheetBundle类属于Cassette.Stylesheets命名空间,在下文中一共展示了StylesheetBundle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StylesheetPipeline_Process_TestBase
public StylesheetPipeline_Process_TestBase()
{
settings = new CassetteSettings();
bundle = new StylesheetBundle("~");
asset1 = new Mock<IAsset>();
asset2 = new Mock<IAsset>();
bundle.Assets.Add(asset1.Object);
bundle.Assets.Add(asset2.Object);
asset1.SetupGet(a => a.Path)
.Returns("~/asset1.css");
asset1.Setup(a => a.OpenStream())
.Returns(() => "/* @reference \"asset2.css\"; */".AsStream());
asset2.SetupGet(a => a.Path)
.Returns("~/asset2.css");
asset2.Setup(a => a.OpenStream())
.Returns(() => "p { color: White; }".AsStream());
asset1.SetupGet(a => a.References)
.Returns(new[] { new AssetReference(asset1.Object.Path, "~/asset2.css", -1, AssetReferenceType.SameBundle) });
minifier = new MicrosoftStylesheetMinifier();
urlGenerator = new Mock<IUrlGenerator>();
container = new TinyIoCContainer();
container.Register(minifier);
container.Register(urlGenerator.Object);
container.Register(settings);
}
开发者ID:jlopresti,项目名称:cassette,代码行数:27,代码来源:StylesheetPipeline.cs
示例2: GivenStylesheetCondition_WhenRender_ThenConditionalCommentWrapsLinks
public void GivenStylesheetCondition_WhenRender_ThenConditionalCommentWrapsLinks()
{
var bundle = new StylesheetBundle("~/test")
{
Condition = "CONDITION"
};
bundle.Assets.Add(new StubAsset());
bundle.Assets.Add(new StubAsset());
var urlGenerator = new Mock<IUrlGenerator>();
var assetUrls = new Queue<string>(new[] { "asset1", "asset2" });
urlGenerator.Setup(g => g.CreateAssetUrl(It.IsAny<IAsset>(), It.IsAny<bool>()))
.Returns(assetUrls.Dequeue);
var renderer = new DebugStylesheetHtmlRenderer(urlGenerator.Object);
var html = renderer.Render(bundle);
html.ShouldEqual(
"<!--[if CONDITION]>" + Environment.NewLine +
"<link href=\"asset1\" type=\"text/css\" rel=\"stylesheet\"/>" +
Environment.NewLine +
"<link href=\"asset2\" type=\"text/css\" rel=\"stylesheet\"/>" + Environment.NewLine +
"<![endif]-->"
);
}
开发者ID:Zocdoc,项目名称:cassette,代码行数:25,代码来源:DebugStylesheetHtmlRenderer.cs
示例3: StubStylesheetBundle
static StylesheetBundle StubStylesheetBundle(string path)
{
var bundle = new StylesheetBundle(path);
var asset = new Mock<IAsset>();
asset.SetupGet(a => a.Hash).Returns(new byte[] { 1, 2, 3 });
bundle.Assets.Add(asset.Object);
return bundle;
}
开发者ID:prasanths,项目名称:cassette,代码行数:8,代码来源:CassetteRouting.cs
示例4: StubStylesheetBundle
static StylesheetBundle StubStylesheetBundle(string path)
{
var bundle = new StylesheetBundle(path)
{
Hash = new byte[] { 1, 2, 3 }
};
return bundle;
}
开发者ID:jlopresti,项目名称:cassette,代码行数:8,代码来源:UrlGenerator_CreateBundleUrl_Tests.cs
示例5: AddCssAsset
Mock<IAsset> AddCssAsset(StylesheetBundle bundle, string css)
{
var asset = new Mock<IAsset>();
bundle.Assets.Add(asset.Object);
asset.SetupGet(a => a.Path).Returns("asset.css");
asset.Setup(a => a.OpenStream()).Returns(() => css.AsStream());
return asset;
}
开发者ID:jlopresti,项目名称:cassette,代码行数:9,代码来源:ParseCssReferences.cs
示例6: GivenProductionMode_WhenProcess_ThenBundleRenderIsStylesheetHtmlRenderer
public void GivenProductionMode_WhenProcess_ThenBundleRenderIsStylesheetHtmlRenderer()
{
var processor = new AssignStylesheetsRenderer();
var settings = new CassetteSettings { IsDebuggingEnabled = false };
var bundle = new StylesheetBundle("~/test");
processor.Process(bundle, settings);
bundle.Renderer.ShouldBeType<StylesheetHtmlRenderer>();
}
开发者ID:prasanths,项目名称:cassette,代码行数:10,代码来源:AssignStylesheetRenderer.cs
示例7: Configure
public void Configure(BundleCollection bundles, CassetteSettings settings)
{
var script = new ScriptBundle("cassette.web.jasmine");
script.Assets.Add(new ResourceAsset("Cassette.Web.Jasmine.jasmine.js", GetType().Assembly));
bundles.Add(script);
var css = new StylesheetBundle("cassette.web.jasmine");
css.Assets.Add(new ResourceAsset("Cassette.Web.Jasmine.jasmine.css", GetType().Assembly));
bundles.Add(css);
}
开发者ID:ryansroberts,项目名称:cassette,代码行数:10,代码来源:CassetteConfiguration.cs
示例8: GivenDebugMode_WhenProcess_ThenBundleRenderIsDebugStylesheetHtmlRenderer
public void GivenDebugMode_WhenProcess_ThenBundleRenderIsDebugStylesheetHtmlRenderer()
{
var settings = new CassetteSettings { IsDebuggingEnabled = true };
var processor = new AssignStylesheetRenderer(Mock.Of<IUrlGenerator>(), settings);
var bundle = new StylesheetBundle("~/test");
processor.Process(bundle);
bundle.Renderer.ShouldBeType<DebugStylesheetHtmlRenderer>();
}
开发者ID:jlopresti,项目名称:cassette,代码行数:10,代码来源:AssignStylesheetRenderer.cs
示例9: ProcessCallsProcessor
public void ProcessCallsProcessor()
{
var bundle = new StylesheetBundle("~");
var pipeline = new Mock<IBundlePipeline<StylesheetBundle>>();
bundle.Pipeline = pipeline.Object;
bundle.Process(new CassetteSettings());
pipeline.Verify(p => p.Process(bundle));
}
开发者ID:jlopresti,项目名称:cassette,代码行数:10,代码来源:StylesheetBundle.cs
示例10: ProcessCallsProcessor
public void ProcessCallsProcessor()
{
var bundle = new StylesheetBundle("~");
var processor = new Mock<IBundleProcessor<StylesheetBundle>>();
bundle.Processor = processor.Object;
bundle.Process(new CassetteSettings());
processor.Verify(p => p.Process(bundle, It.IsAny<CassetteSettings>()));
}
开发者ID:prasanths,项目名称:cassette,代码行数:10,代码来源:StylesheetBundle.cs
示例11: CreateStylesheetBundle
static StylesheetBundle CreateStylesheetBundle()
{
var bundle = new StylesheetBundle("~");
var asset = new StubAsset(
"~/asset.css",
".a { background-image:url(image-a.png);background-repeat:no-repeat;width:20px;height:20px }\n" +
".b { background-image:url(image-b.png);background-repeat:no-repeat;width:20px;height:20px }"
);
bundle.Assets.Add(asset);
return bundle;
}
开发者ID:jlopresti,项目名称:cassette,代码行数:11,代码来源:SpritingIntegrationTest.cs
示例12: WhenProcessCssReferenceWithoutTrailingSemicolon_ThenAssetAddReferenceIsCalled
public void WhenProcessCssReferenceWithoutTrailingSemicolon_ThenAssetAddReferenceIsCalled()
{
var bundle = new StylesheetBundle("~");
var css = "/* @reference \"test.css\" */";
var asset = AddCssAsset(bundle, css);
var processor = new ParseCssReferences();
processor.Process(bundle, new CassetteSettings());
asset.Verify(a => a.AddReference("test.css", 1));
}
开发者ID:prasanths,项目名称:cassette,代码行数:11,代码来源:ParseCssReferences.cs
示例13: WhenProcessSimpleCssReferenceWithSingleQuotes_ThenAssetAddReferenceIsCalled
public void WhenProcessSimpleCssReferenceWithSingleQuotes_ThenAssetAddReferenceIsCalled()
{
var bundle = new StylesheetBundle("~");
var css = "/* @reference 'test.css'; */";
var asset = AddCssAsset(bundle, css);
var processor = new ParseCssReferences();
processor.Process(bundle, new CassetteSettings());
asset.Verify(a => a.AddReference("test.css", 1));
}
开发者ID:prasanths,项目名称:cassette,代码行数:11,代码来源:ParseCssReferences.cs
示例14: WhenProcessSimpleCssReference_ThenAssetAddReferenceIsCalled
public void WhenProcessSimpleCssReference_ThenAssetAddReferenceIsCalled()
{
var bundle = new StylesheetBundle("~");
var css = "/* @reference \"test.css\"; */";
var asset = AddCssAsset(bundle, css);
var processor = new ParseCssReferences();
processor.Process(bundle);
asset.Verify(a => a.AddReference("test.css", 1));
}
开发者ID:jlopresti,项目名称:cassette,代码行数:11,代码来源:ParseCssReferences.cs
示例15: WhenProcessTwoCssReferencesInSameComment_ThenAssetAddReferenceIsCalledTwice
public void WhenProcessTwoCssReferencesInSameComment_ThenAssetAddReferenceIsCalledTwice()
{
var bundle = new StylesheetBundle("~");
var css = "/* @reference \"test1.css\"; \n @reference \"test2.css\"; */";
var asset = AddCssAsset(bundle, css);
var processor = new ParseCssReferences();
processor.Process(bundle);
asset.Verify(a => a.AddReference("test1.css", 1));
asset.Verify(a => a.AddReference("test2.css", 2));
}
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:ParseCssReferences.cs
示例16: GivenACompiler_WhenProcessCalled_ThenCompileAssetTransformerAddedToLessAsset
public void GivenACompiler_WhenProcessCalled_ThenCompileAssetTransformerAddedToLessAsset()
{
var processor = new CompileLess(Mock.Of<ILessCompiler>(), new CassetteSettings());
var bundle = new StylesheetBundle("~");
var asset = new Mock<IAsset>();
asset.SetupGet(a => a.Path).Returns("test.less");
bundle.Assets.Add(asset.Object);
processor.Process(bundle);
asset.Verify(a => a.AddAssetTransformer(It.Is<IAssetTransformer>(at => at is CompileAsset)));
}
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:CompileLess.cs
示例17: WhenModifiedPipelineProcessesBundle_ThenLessAssetHasCompileAssetTransformAdded
public void WhenModifiedPipelineProcessesBundle_ThenLessAssetHasCompileAssetTransformAdded()
{
var asset = new Mock<IAsset>();
asset.SetupGet(a => a.Path).Returns("~/file.less");
asset.Setup(a => a.OpenStream()).Returns(Stream.Null);
var bundle = new StylesheetBundle("~");
bundle.Assets.Add(asset.Object);
modifiedPipeline.Process(bundle);
asset.Verify(a => a.AddAssetTransformer(It.Is<IAssetTransformer>(t => t is CompileAsset)));
}
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:LessBundlePipelineModifier.cs
示例18: SpritingIntegrationTest
public SpritingIntegrationTest()
{
container = CreateContainer();
cache = new TempDirectory();
InitDirectories();
bundle = CreateStylesheetBundle();
// SpriteImages expects image URLs to be expanded into absolute Cassette file URLs.
ExpandUrls(bundle);
SpriteImages(bundle);
}
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:SpritingIntegrationTest.cs
示例19: StylesheetBundleSerializer_Tests
public StylesheetBundleSerializer_Tests()
{
bundle = new StylesheetBundle("~")
{
Hash = new byte[0],
Media = "MEDIA",
Condition = "CONDITION",
Renderer = new StylesheetHtmlRenderer(Mock.Of<IUrlGenerator>())
};
WriteToElement();
}
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:StylesheetBundleSerializer.cs
示例20: StylesheetBundleSerializer_Tests
public StylesheetBundleSerializer_Tests()
{
bundle = new StylesheetBundle("~")
{
Hash = new byte[0],
Media = "MEDIA",
Condition = "CONDITION",
Renderer = new ConstantHtmlRenderer<StylesheetBundle>("", new VirtualDirectoryPrepender("/"))
};
WriteToElement();
}
开发者ID:pyttroll,项目名称:cassette,代码行数:12,代码来源:StylesheetBundleSerializer.cs
注:本文中的Cassette.Stylesheets.StylesheetBundle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论