从父目录node-sass导入

我使用node-sass来模拟我的CDN构build,并将我的CSS转换为模块化的Sassdevise。 基本上我的设置涉及品牌网站覆盖常见的风格。

我想在品牌文件夹中做这样的事情

@import "../common/global-config"; @import "brand-config"; @import "../common/common"; // brand specific styles here 

这个文件将位于/css/brand-name/brand.scss

其他文件将in /css/common/_common.scss

我的节点sass设置看起来像这样

 function compileSassFile(includes, path, callback) { if (!fs.existsSync(path)) { return null; } var css = sass.renderSync({ file: path, success: callback, outputStyle: 'expanded', includePaths: includes }); return css; } // bundlePath = 'css', dirName = '/brand-name' compileSassFile([path.join(bundlePath), path.join(bundlePath, 'common'), path.join(bundlePath, dirName)], path.join.apply(bundlePath, [dirName, 'brand.scss']));