将SCSS文件捆绑到CSS中

时间:2013-11-08 17:17:02

标签: asp.net css sass bundle integrate

我正在尝试使用Bundle方法将Asp.Net中的scss文件集成:

public static void RegisterBundles(BundleCollection bundles) {
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/modernizr").Include("~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/css/bootstrap.css","~/Content/css/Site.css"));

var sassBundle = new Bundle("~/content/style-bundle").Include(
"~/content/css/style.scss" );
sassBundle.Transforms.Add(new BundleTransformer.Core.Transformers.CssTransformer());
sassBundle.Transforms.Add(new CssMinify());
sassBundle.Orderer = new BundleTransformer.Core.Orderers.NullOrderer();
bundles.Add(sassBundle);
 }
}

我收到以下错误:

An exception of type 'BundleTransformer.Core.Translators.AssetTranslationException' occurred in BundleTransformer.SassAndScss.dll but was not handled in user code

其他信息:在翻译SCSS代码期间,从文件'/content/css/style.scss'重新编译,到CSS代码语法错误已经发生。

查看更多详情:

Message: Undefined mixin 'box-shadow'.

File: /content/css/covve/_colours.scss

Line number: 56

我已经下载了所有的Sass lib.Can任何人都可以帮助我,我是sass文件的新手。 先感谢您!

1 个答案:

答案 0 :(得分:0)

确保包含box-shadow mixin的文件已导入您正在处理的文件here