0
我想使用導入程序編譯SCSS文件。使用導入程序的節點SASS
我的代碼,不工作:
var sassFilesMatchPatterns = [
'styles/default/components/badge/_settings.scss',
'styles/default/components/badge/_badge.scss'
]
var sass = require('node-sass');
sassFilesMatchPatterns.forEach(function (file) {
sass.render({
file: file
}, function(err, result) {
if (err) {
console.log(err + '\r\n' + JSON.stringify(result) + file);
}
});
});
// _badge.scss
.badge {
background-color: $badge-bg;
color: text-contrast($badge-bg);
padding: 0 15px;
line-height: $badge-height;
height: $badge-height;
border-radius: 10px;
display: inline-block;
box-shadow: 0 0 5px gray;
}
// _settings.scss
$black: #000;
$white: #fff;
$badge-bg: $main-color;
$badge-height: 22px;
問題:
Error: Undefined variable: "$badge-bg". nullstyles/default/components/badge/_badge.scss
我想用我的NodeJS腳本導入'_settings.scss'而不是使用SASS。 – tonymx227