我正在尝试设置grunt来自动将SCSS编译为CSS。 我首先使用Ruby安装Sass,然后安装了Grunt,并使用gruntfile.js运行它:
gruntfile.js
select bookID, title, author, publish_year
from (
select bookID, title, author, publish_year
, rank() over(order by publish_year) rnk
from book
) d
where rnk = 1
当我运行命令时:
警钟
Grunt运行并监视我的文件中的任何更改,它将看到更改,但从未将SCSS转换为CSS。
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'mysite/static/css/grunt.css' : 'mysite/static/sass/_video.scss'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default',['watch']);
}
我正在使用本指南:http://ryanchristiani.com/getting-started-with-grunt-and-sass/
答案 0 :(得分:0)
尝试以下设置
grunt.initConfig({
sass: {
dev: {
src: ['mysite/static/sass/_video.scss'],
dest: 'mysite/static/css/grunt.css',
},
},
watch: {
sass: {
files: ['mysite/static/sass/*.scss'],
tasks: ['sass'],
},
livereload: {
options: { livereload: true },
files: ['mysite/**/*'],
},
},
});