2

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']));
4

0 に答える 0