我觉得现在有点卡住了。首先我用nuget来
install-package Bootstrap.less
以及
安装包无点
然后,如图所示 关于捆绑和缩小的Rick Andersons Blogpost 在asp.net mvc中,我创建了一个LessTransform-Class。我设置了两个几乎空的.less文件并创建了一个新的包装包装......
var lessBundle = new Bundle("~/MyLess").IncludeDirectory("~/Content/MyLess", "*.less", true);
lessBundle.Transforms.Add(new LessTransformer());
lessBundle.Transforms.Add(new CssMinify());
bundles.Add(lessBundle);
这很好用。然后我在主bootstrap.less文件中添加了一个新的StyleBundle(它基本上使用@import来包含bootstrap.less发送的所有其他.less文件)...
bundles.Add(new StyleBundle("~/Bootstrap").Include("~/Content/Bootstrap/less/bootstrap.less"));
和一个ScriptBundle到引导程序JavaScripts ...
bundles.Add(new ScriptBundle("~/bundles/Bootstrap").Include("~/Scripts/bootstrap/js/bootstrap-*"));
包括所有发货的bootstrap - * .js文件和TADAA一切正常。 CSS已编译,包括正确加载的所有导入的JavaScript文件。
但是......所有这些只适用于开发模式
<compilation debug="true" targetFramework="4.5"/>
一旦我禁用调试以查看捆绑到一个文件和缩小是否正常工作我遇到问题。
捆绑过程似乎无法导入导入bootstrap.less的所有无。文件
/* Minification failed. Returning unminified contents.
(11,1): run-time error CSS1019: Unexpected token, found '/'
(11,2): run-time error CSS1019: Unexpected token, found '/'
(12,1): run-time error CSS1031: Expected selector, found '@import'
(12,1): run-time error CSS1025: Expected comma or open brace, found '@import'
(12,27): run-time error CSS1019: Unexpected token, found '/'
(12,28): run-time error CSS1019: Unexpected token, found '/'
... here go many many lines like these
(60,25): run-time error CSS1019: Unexpected token, found ';'
(62,1): run-time error CSS1019: Unexpected token, found '/'
(62,2): run-time error CSS1019: Unexpected token, found '/'
(63,1): run-time error CSS1031: Expected selector, found '@import'
(63,1): run-time error CSS1025: Expected comma or open brace, found '@import'
(63,27): run-time error CSS1019: Unexpected token, found '/'
(63,28): run-time error CSS1019: Unexpected token, found '/'
: run-time error CSS1067: Unexpected end of file encountered
*/
/*!
* Bootstrap v2.3.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "mixins.less";
... and the rest of the original bootstrap.less... no style definitions
看一下缩小的bootstrap.javascript包也让我很难过。在开发中加载页面后没有问题,现在在bootstrap.javascript捆绑并在Google中缩小了JavaScript控制台状态
Uncaught TypeError: Cannot read property 'Constructor' of undefined
我看过几个与我的问题密切相关的话题,我尝试了一些事情,但到目前为止还没有成功。
非常感谢任何能够为我的情况提供一些启示,并指出我错过或做错的人。最好的问候,Ingo