2014-12-27 2 views
0

안녕하세요 저는 Grunt를 사용하여 내 적은 코드를 CSS에 컴파일하고 있습니다. .less 파일을 변경했는지 확인하려면 다음을 사용하십시오.그란트 시계가 계속 무한히 보임

grunt watch 

그런 다음, 나는 .less 파일을 편집하고있었습니다. 하지만 cmd에서 아무 일도 일어나지 않습니다. 나는 여전히 그가 .less 파일을보고 있다는 것을 알고 있습니다. 여기의 스크린 샷은 다음과 같습니다

링크 :

gruntfile.js :

module.exports = function(grunt) { 

    grunt.initConfig({ 
    less: { 
     development: { 
     options: { 
      compress: true, 
      yuicompress: true, 
      optimization: 2 
     }, 
     files: { 
      "css/styles.css": "css/styles.less" // destination file and source file 
     } 
     } 
    }, 
    watch: { 
     styles: { 
     files: ['less/styles.less'], // which files to watch 
     tasks: ['less'], 
     options: { 
      nospawn: true 
     } 
     } 
    } 
    }); 
    grunt.loadNpmTasks('grunt-contrib-less'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 
    grunt.registerTask('default', ['less', 'watch']); 
}; 

package.json :

{ 
    "name": "Coming_soon_code", 
    "version": "0.0.0", 
    "description": "van een tut", 
    "main": "gruntfile.js", 
    "scripts": { 
    "test": "echo \"Error: no test specified\" && exit 1" 
    }, 
    "author": "", 
    "license": "BSD-2-Clause", 
    "devDependencies": { 
    "grunt": "~0.4.5", 
    "grunt-contrib-less": "~1.0.0", 
    "grunt-contrib-watch": "~0.6.1" 
    } 
} 
다음

http://i.imgur.com/hT8l18f.png 내가 사용하는 코드는

필요한 경우 내 폴더 구조의 스크린 샷은 다음과 같습니다.

링크 : http://i.imgur.com/WWAJZb0.png

답변

1

당신은 'less/styles.less' 파일을 "보고"한 것으로 나타났습니다 ...하지만 그 스크린 샷 또는 less 작업 설정에 따라 올바른 디렉토리가 아닌, 그것은 css 디렉토리에 있습니다. 시도해보십시오.

watch: { 
    styles: { 
    files: ['css/styles.less'], // <-- changed the directory here... 
    tasks: ['less'], 
    options: { 
     nospawn: true 
    } 
    } 
} 
+0

답장 해 주셔서 감사합니다. 또한 .css 파일을 축소하지 않는 방법을 알고 계십니까? 나는 이미 시도 : css : [ 'concat'] 내 gruntfile.js,하지만 그 작동하지 않습니다. 나는 .css 파일을 축소하려고하지 않는다. 왜냐하면 때때로 .css가 .less 파일에서 컴파일 된 후에 어떻게 보이는지 궁금하기 때문이다. – superkytoz

+1

['compress' 옵션] (https://github.com/gruntjs/grunt-contrib-less#compress)을'false'로 설정하는 것처럼 보이지만 기본값입니다. 태만)... – jakerella