Gulp 大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大

Gulp 大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大口大,gulp,gulp-compass,Gulp,Gulp Compass,我刚开始使用gulp,我想我已经正确地设置了它,但它似乎没有做它应该做的事情 我的gulpfile.js gulp.task('compass', function() { return gulp.src('sites/default/themes/lsl_theme/sass/**/*.scss') .pipe(compass({ config_file: 'sites/default/themes/lsl_theme/config.rb',

我刚开始使用gulp,我想我已经正确地设置了它,但它似乎没有做它应该做的事情

我的gulpfile.js

    gulp.task('compass', function() {
      return gulp.src('sites/default/themes/lsl_theme/sass/**/*.scss')
      .pipe(compass({
        config_file: 'sites/default/themes/lsl_theme/config.rb',
        css: 'css',
        sass: 'scss'
      }))
      .pipe(gulp.dest('./sites/default/themes/lsl_theme/css'))
      .pipe(notify({
        message: 'Compass task complete.'
      }))
      .pipe(livereload());
   });

还有手表的功能

gulp.task('watch', function() {
  livereload.listen();
  gulp.watch('./sites/default/themes/lsl_theme/js/**/*.js', ['scripts']);
  gulp.watch('./sites/default/themes/lsl_theme/sass/**/*.scss', ['compass']);
});
当我大口喝的时候,结果是

[16:14:36] Starting 'compass'...
[16:14:36] Starting 'scripts'...
[16:14:36] Starting 'watch'...
[16:14:37] Finished 'watch' after 89 ms
并且没有注册任何更改


对于文件结构,我的gulpfile.js位于根目录中,而sass、css和js都位于root/sites/default/themes/lsl_主题中,其中sass文件夹包含的文件夹“components”中充满了部分内容。

我的假设是您在windows上?如果我错了,请纠正我

存在这样一个问题,
gulp notify
往往会中断
gulp.watch
功能。试着评论一下

// .pipe(notify({
//   message: 'Scripts task complete.'
// }))
看看问题是否仍然存在

如果这确实解决了问题,那么来自的解决方案可能会有所帮助

您可以与 这个 要确定您是否在Windows上,请排除
gulp notify
,如 因此:


事实证明,我的问题很大一部分仅仅是因为我是一个喝得烂醉如泥的新手。当我从我的gulp手表中删除
“脚本”
时,它开始工作

然后,我连接到它正在监视的目录与它正在放置新的连接和缩小的js文件的目录相同,因此它正在放置新文件,检查该文件,并反复循环,导致内存问题,同时不允许运行
'compass'

在创建了一个“dest”文件夹来存放新的js之后,一切都开始正常工作

// .pipe(notify({
//   message: 'Scripts task complete.'
// }))
var _if = require('gulp-if');

//...

// From https://stackoverflow.com/questions/8683895/variable-to-detect-operating-system-in-node-scripts
var isWindows = /^win/.test(require('os').platform());

//...

     // use like so:
    .pipe(_if(!isWindows, notify('Coffeescript compile successful')))