2014-07-10 5 views
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)을 실행하는지 이해하지 못합니다.

희망을 누군가가 해결할 수 있기를 바랍니다. :)

답변

0

나는 이것이 문제가 아니지만, sass, 단지 sass:dist을 모두 실행하지 않도록 지정하십시오. 따라서 시도하십시오 : grunt.registerTask('default', ['newer:sass:dist']);

관련 문제