从父目录node-sass导入

时间:2013-10-23 19:49:59

标签: css node.js sass compass-sass

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

我想在品牌文件夹

中做这样的事情
@import "../common/global-config";
@import "brand-config";
@import "../common/common";

// brand specific styles here

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

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

我的node-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']));

0 个答案:

没有答案