使用 GULP 编译 SASS 和 SUSY

2022-01-12 00:00:00 javascript sass gulp susy-sass

我正在尝试让 gulp 编译我的 sass 并使用 susy 网格/框架.

I am trying to get gulp to compile my sass and use the susy grid/framework.

我无法在网上找到有关此的任何信息.

I'm having troubles finding any information about this online.

我已包括:

"gulp-ruby-sass": "^0.7.1",

进入我的 package.json 并安装一切.

into my package.json and installed everything.

我的 gulp sass gulp 任务喜欢这样:

My gulp sass gulp task likes like so:

gulp.task('sass', ['images'], function () {
  return gulp.src('src/sass/*.{sass, scss}')
    .pipe(sass({
      bundleExec: true,
      sourcemap: true,
      sourcemapPath: '../sass'
    }))
    .on('error', handleErrors)
    .pipe(gulp.dest('build'));
});

所以我一生都无法弄清楚如何包含 susy 以使其符合使用 gulp 的要求,我没有看过也似乎看不到在线查找与此相关的任何内容.

So I can't for the life of me work out how to include susy so it complies using gulp, I haven't looked and can't seem to find anything relating to this online.

推荐答案

你可以使用gulp-compass,你只需要在你的系统中安装compass并安装gulp-compass 通过 npm 打包,示例代码如下:

You can use gulp-compass, you only need to have compass installed in your system and install gulp-compass package through npm, here is a sample code:

var compass = require('gulp-compass');

gulp.task('compass', function() {
  return gulp.src('./src/*.scss')
  .pipe(compass({
    // Gulp-compass options and paths
    css: 'app/assets/css',
    sass: 'app/assets/sass',
    require: ['susy']
  }))
  .on('error', handleErrors)
  .pipe(gulp.dest('app/assets/temp'));
});

关于这个包的更多信息这里

相关文章