我正在尝试运行compass
来编译我的.scss
文件。我收到以下错误:
Running "compass:dist" (compass) task
Compass can't find any Sass files to compile.
Is your compass configuration correct?.
If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Running "watch" task
Waiting...
我的.scss
个文件存储在/myproject/sass/
和/myproject/sass/bootstrap/
我希望将.scss
个文件编译成缩小的style.css
文件。
我需要做些什么才能对此进行排序?
compass: {
dist: {
options: {
sassDir: 'sass',
cssDir: 'css'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['compass']
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-minified');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default',['concat', 'minified', 'uglify', 'compass', 'watch']);
这可能值得尝试:
watch: {
sass: {
files: '/sass/**/*.scss',
tasks: ['default']
},
},
答案 0 :(得分:0)
我通过添加以下代码修复了它:
compass: {
compile: {
options: {
cssDir: 'css'
}
}
},
这会编译css(不会缩小)。我还为文件和目录更改了其他几个值,因此我的grunt文件现在看起来像这样:
compass: {
dist: {
options: {
sassDir: ['sass/**/*.scss', 'sass/*.scss'],
cssDir: 'css/style.css'
}
}
},
compass: {
compile: {
options: {
cssDir: 'css'
}
}
},
watch: {
css: {
files: ['sass/style.scss'],
tasks: ['compass']
}
}