如何解决我的问题?这里是我的gulpfile.js
const gulp = require('gulp');
const webp = require('gulp-webp');
const browserSync = require('browser-sync');
const origin = 'app';
const destination = 'app';
gulp.task('webp', () =>
gulp
.src(`${origin}/img/**`)
.pipe(webp())
.pipe(gulp.dest(`${destination}/img`))
);
gulp.task('live', function () {
gulp.watch('**/*.css').on('change', function () {
browserSync.reload();
});
});
这是我的package.json
{
"name": "gulp-browsersync",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "node-sass --watch app/scss -o app/css"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.10",
"gulp": "^4.0.2",
"gulp-webp": "^4.0.1",
"node-sass": "^4.14.1"
},
"dependencies": {}
}
这是我的终端日志
[13:39:25] Using gulpfile ~\Desktop\gulp-browsersync-main\gulpfile.js
[13:39:25] Task never defined: default
[13:39:25] To list available tasks, try running: gulp --tasks
1条答案
按热度按时间lvjbypge1#
您需要从您的
gulpfile.js
中exports
一个函数作为default
检查gulp-doc和创建任务
gulp需要一个函数来启动任务,你必须使用
exports.default
你主任务函数。如果你有多个任务,你需要使用series
或parallel
。密码: