Javascript gruntjs没有';不能在sass上正常运行
已经调试了几个小时了 当我保存我的.html文件时,livereload起作用了,但对于我的.scs文件,我在下面的配置中做了什么错误?Chrome的终端和控制台没有显示错误Javascript gruntjs没有';不能在sass上正常运行,javascript,css,sass,gruntjs,Javascript,Css,Sass,Gruntjs,已经调试了几个小时了 当我保存我的.html文件时,livereload起作用了,但对于我的.scs文件,我在下面的配置中做了什么错误?Chrome的终端和控制台没有显示错误 module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { sass: { f
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['components/sass/*.{scss,sass}'],
tasks: ['sass']
},
livereload: {
files: ['*.html', '*.php', 'js/**/*.{js,json}', 'css/*.css','img/**/*.{png,jpg,jpeg,gif,webp,svg}'],
options: {
livereload: true
}
}
},
sass: {
options: {
sourceMap: true,
outputStyle: 'compressed'
},
files: {
'css/styles.css': 'components/sass/styles.scss'
}
}
});
grunt.registerTask('default', ['sass', 'watch']);
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
}
将
options.livereload
添加到您的watch.sass
中:
watch: {
sass: {
files: ['components/sass/*.{scss,sass}'],
tasks: ['sass'],
options: {
livereload: true
}
},
// ...
我也遇到过同样的问题,我相信(虽然不是100%确定)这是因为手表没有触发两个任务,如果它们在时间上太近: