我已经使用git clone并在没有sudo的情况下运行npm install,同样的设置在Windows机器上运行完美但在Mac OSX上打破了:
这是我的gulpfile.js
var gulp = require('gulp');
// Load plugins
var plugin = require('gulp-load-plugins')({
pattern: '*'
});
var paths = {
css: 'app/resources/css',
sass: 'app/resources/scss',
js: 'app/**/*.module.js, app/components/**/*.js',
html: 'app/*.html'
};
// Compile SASS using Compass,
// Compass required as we using its utitlities
gulp.task('compass', function(){
return gulp.src( paths.sass + '/*.scss' )
.pipe(plugin.compass({
css: paths.css,
sass: paths.sass,
task: 'watch',
comments: false
}));
});
// Watch task, keep checking for changes
gulp.task('watch', function(){
gulp.watch([
paths.sass + '/*.scss',
paths.html,
paths.js
]).on('change', plugin.browserSync.reload);
});
// LiveReload Task
gulp.task('serve', function(){
plugin.browserSync.init([], {
server: {
baseDir: ['./', './app']
}
});
});
// Build HTML
gulp.task('html', function(){
return gulp.src('app/*.html')
.pipe(plugin.useref())
.pipe(gulp.dest('dist'));
});
// Copy Images
gulp.task('images', function(){
return gulp.src('app/resources/images/*')
.pipe(gulp.dest('dist/resources/images/'));
});
// Copy Fonts
gulp.task('fonts', function(){
return gulp.src('app/resources/fonts/*')
.pipe(gulp.dest('dist/resources/fonts/'));
});
// Copy Templates
gulp.task('templates', function(){
return gulp.src('app/components/**/*')
.pipe(gulp.dest('dist/components/'));
});
// Clean
gulp.task('clean', function(){
return gulp.src([
'dist/base', 'dist/components', 'dist/resources'
], {
read: false
})
.pipe( plugin.clean());
});
// Build
gulp.task('build', [ 'compass', 'html', 'images', 'fonts', 'templates', 'serve'])
// Default
gulp.task('default', ['clean'], function(){
gulp.start('build');
});
我在终端上遇到以下错误,认为路径选错了不知道我弄错了:
events.js:163
throw er; // Unhandled 'error' event
^
Error: Error: File not found with singular glob: /learning/recharge-desktop-code/learning/recharge-desktop-code/app/resources/css/common.css
at DestroyableTransform.<anonymous> (/learning/recharge-desktop-code/node_modules/gulp-useref/index.js:65:28)
at emitOne (events.js:101:20)
at DestroyableTransform.emit (events.js:191:7)
at emitOne (events.js:101:20)
at Through2.emit (events.js:191:7)
at OrderedStreams.<anonymous> (/learning/recharge-desktop-code/node_modules/gulp-useref/node_modules/glob-stream/index.js:140:20)
at emitOne (events.js:96:13)
at OrderedStreams.emit (events.js:191:7)
at emitOne (events.js:96:13)
at DestroyableTransform.emit (events.js:191:7)
答案 0 :(得分:0)
奇怪,这是路径问题我已经改变了我的html中的css路径并且它工作了,而在Windows机器上不需要同样的,有人可以帮助理解这个吗?
答案 1 :(得分:0)
也许是这个问题。 它会说
Thanks! We are aware of this issue and a fix is being worked on. Closing as this is a duplicate of #12841. Be on the lookout for the next v7.x release (which will probably be next week). Thanks!