我必须在吞咽中做两个步骤:
这是我的gulpfile:
var gulp = require('gulp'),
watch = require("gulp-watch"),
less = require('gulp-less'),
cssmin = require('gulp-cssmin'),
rename = require('gulp-rename');
gulp.task('watch-less', function () {
watch({glob: './*.less'}, function (files) { // watch any changes on coffee files
gulp.start('compile-less'); // run the compile task
});
watch({
glob: ['./*.css', '!./*.min.css']
}, function(files) {
gulp.start('minify-css'); // run the compile task
});
});
gulp.task('compile-less', function () {
gulp.src('./*.less') // path to your file
.pipe(less().on('error', function(err) {
console.log(err);
}))
.pipe(gulp.dest('./'));
});
gulp.task('minify-css', function() {
gulp.src([
'./*.css', …Run Code Online (Sandbox Code Playgroud) 此代码在9.0.3版中不起作用:
server.route({
method: 'GET',
path: '/',
handler: function() {
file: 'templates/index.html'
}
});
Run Code Online (Sandbox Code Playgroud)
错误:
de_modules/hapi/node_modules/hoek/lib/index.js:723
throw new Error(msgs.join(' ') || 'Unknown error');
^
Error: Unknown handler: file
Run Code Online (Sandbox Code Playgroud)
在版本8中,它运行良好.