是Gruntfile.js的片段,其中添加了browserSync,安装在localhost上。不幸的是,尽管没有立即发生的错误,但browserSync无法正常工作。有什么想法吗?
// Watch changes for assets.
watch: {
css: {
files: [
'style.scss',
'assets/css/admin/welcome-screen/*.scss',
'assets/css/woocommerce/*.scss',
'assets/css/woocommerce/extensions/*.scss',
'assets/css/jetpack/*.scss',
'assets/css/base/*.scss',
'assets/css/components/*.scss',
'assets/css/sass/utils/*.scss',
'assets/css/sass/vendors/*.scss'
],
tasks: [
'sass',
'css'
]
},
js: {
files: [
//removed file names
],
tasks: ['jshint', 'uglify']
}
},
browserSync: {
dev: {
bsFiles: {
src: [
'style.css'
]
},
options: {
watchTask: true,
proxy: 'http://localhost/ii/'
}
}
},
之后,我添加了
grunt.loadNpmTasks( 'grunt-browser-sync' );
作为注册任务:
// Register tasks
grunt.registerTask( 'default', [
'css',
'jshint',
'uglify',
'browserSync'
]);