捆绑少和CSS文件一起 [英] Bundling less and css files together
问题描述
我觉得应该对成组的一堆您使用连成一个单一的交付到浏览器的文件捆绑。这意味着例如,对于我的根的风格我愿做类似如下:
I feel like bundling should be used to group a bunch of files which you use together into one single delivery to the browser. This would mean for example for my root style I would like to do something like the following:
var bundle = new StyleBundle("~/Content/style").Include(
"~/Content/mystyle.less",
"~/Content/bootstrap.css",
"~/Content/bootstrap-responsive.css");
bundle.Transforms.Add(new LessTransform());
bundle.Transforms.Add(new CssMinify());
bundles.Add(bundle);
但是,这似乎不符合的自定义转换技术捆绑减档,因为它看起来像pre-捆绑了所有的文件到一个单一的CSS文件将它传递给LessTransform之前。从我可以告诉这个方法只有当你捆绑所有的减档一起工作。
But this doesn't seem to work very well with the custom transform technique for bundling less files as it looks like it pre-bundles all of the files into a single css file before passing it to the LessTransform. From what i can tell this method only works if you bundle all of your less files together.
有没有办法让捆绑,允许在同一个包均不和CSS文件?
Is there a way to get bundles to allow both less and css files in the same bundle?
推荐答案
我有更多一点一看这个,用捆绑,而不是试图StyleBundle但仍有问题。我认为这个问题是特别是与有一些语法,少不喜欢bootstrap.css文件来完成。
I had a bit more of a look into this and tried using Bundle instead of StyleBundle but still had issues. I think the issue is specifically to do with the bootstrap.css file having some syntax which less doesn't like.
这篇关于捆绑少和CSS文件一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!