我正在尝试编写模块化的Ionic1.x应用程序。我打算编译& concat&缩小javascript和scss文件。
但是,当我在压缩任务中使用minify函数时,我在sass任务上遇到了以下错误。
Muhammets-MacBook-Pro-3:x-app MmtBkn$ gulp
[01:00:29] Using gulpfile ~/Documents/Projects/x-app/gulpfile.js
[01:00:29] Starting 'sass'...
[01:00:29] Starting 'compress'...
[01:00:29] Finished 'compress' after 3.22 ms
[01:00:29] Starting 'watch'...
[01:00:29] Finished 'watch' after 9.32 ms
<--- Last few GCs --->
181117 ms: Scavenge 1386.3 (1457.2) -> 1386.3 (1457.2) MB, 0.3 / 0 ms (+ 0.7 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
182315 ms: Mark-sweep 1386.3 (1457.2) -> 1261.2 (1457.2) MB, 1197.8 / 0 ms (+ 1.6 ms in 2 steps since start of marking, biggest step 0.9 ms) [last resort gc].
183817 ms: Mark-sweep 1261.2 (1457.2) -> 1261.2 (1457.2) MB, 1501.7 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2e01223e3ac1 <JS Object>
2: /* anonymous */(aka /* anonymous */) [0x2e0122304189 <undefined>:~5007] [pc=0x39378c3457ff] (this=0x2e0122304189 <undefined>,self=0x531caddf789 <an AST_Number with map 0x29489836add9>,output=0x38677a93b4f1 <an Object with map 0x29489836c959>)
3: doit(aka doit) [0x2e0122304189 <undefined>:4197] [pc=0x39378c24c878] (this=0x2e0122304189 <undefined>)
4: print [0x2e0122304189 <undefin...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6
是的,我不知道如何或为什么但是,当我评论缩小压缩任务中的行时,sass运行良好。我试图重新安装包,设置新项目等没有任何变化。这是gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var minify = require('gulp-minify');
var paths = {
sass: ['./scss/**/*.scss']
};
gulp.task('serve:before', ['default','watch']);
gulp.task('default', ['sass','compress','watch']);
gulp.task('sass', function(done) {
gulp.src(['./scss/ionic.app.scss','./www/app/**/*.scss'])
.pipe(sass())
.on('error', sass.logError)
.pipe(concat('app.css'))
.pipe(minifyCss())
.pipe(gulp.dest('./www'))
.on('end', done);
});
gulp.task('compress', function() {
gulp.src('./www/**/*.js')
.pipe(concat('app.js'))
.pipe(minify({
ext:{
src:'-debug.js',
min:'.js'
},
exclude: ['./www/lib'],
ignoreFiles: ['.combo.js', '-min.js']
}))
.pipe(gulp.dest('./www'))
});
我的操作系统版本是OS X El Capitan,内存足够多。 包版本是
"gulp": "^3.5.6",
"gulp-sass": "^2.0.4",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-minify":"0.0.14",
"gulp-rename": "^1.2.0"
有什么想法吗?谢谢。