0
나는 다음과 같은 Grunfile.js 파일했습니다 :꿀꿀 시계는 작업을 여러 번 실행
Running "watch" task
Waiting...
>> File "css\style.scss" changed.
Running "newer:sass" (newer) task
Running "newer:sass:dist" (newer) task
Running "sass:dist" (sass) task
File css/build/style.css created.
Running "newer-postrun:sass:dist:1:D:\xampp\htdocs\grunt-test\node_modules\grunt-newer\.cache" (newer-postrun) task
Done, without errors.
:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'css/build/style.css': 'css/style.scss'
}
}
},
watch: {
stylesheets: {
files: ['css/*.scss'],
tasks: ['newer:sass']
}
}
});
// Load the plugin that compiles sass
grunt.loadNpmTasks('grunt-contrib-sass');
// watch for, and run grunt if files change
grunt.loadNpmTasks('grunt-contrib-watch');
// Plugin for Grunt tasks to run with newer files only.
grunt.loadNpmTasks('grunt-newer');
// Grunt Tasks:
grunt.registerTask('default', ['newer:sass']);
};
툴툴 거리는 소리 시계를 실행하고 내하는 SCS 파일을 저장 한 후, 콘솔 출력은 다음입니다 문제는 .scss 파일이 매번 컴파일된다는 것입니다. 변화가 없다고해도.
나는 watch (newer : sass)에 정의 된 작업 만 실행하는 대신 왜 grunt가 3 가지 작업 (최신 : sass, 최신 : sass : dist, sass : dist)을 실행하는지 이해하지 못합니다.
희망을 누군가가 해결할 수 있기를 바랍니다. :)