2015-04-01 30 views
0

grunt-contrib-less包提供了選項compress,它應該允許管理目標CSS文件的uglifying/minifying/compression。它是一個boolean,默認值爲false如何停用grunt中的壓縮更少?

由於任何原因,它不會爲我工作 - 無論我設置參數,輸出CSS文件被壓縮。何讓它正常工作?


Gruntfile.js

module.exports = function(grunt) { 

    // Project configuration. 
    grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 
    less: { 
     development: { 
     options: { 
      paths: ["public/css"], 
      compress: false 
     }, 
     files: { 
      "public/css/style.css": "public/css/style.less" 
     } 
     }, 
     production: { 
     options: { 
      paths: ["public/css"], 
      compress: false, 
      plugins: [ 
      new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]}), 
      new (require('less-plugin-clean-css'))([]) 
      ], 
      modifyVars: { 
      } 
     }, 
     files: { 
      "public/css/style.css": "public/css/style.less" 
     } 
     } 
    } 
    }); 

    // Load the plugin that provides the "less" task. 
    grunt.loadNpmTasks('grunt-contrib-less'); 

    // Default task(s). 
    grunt.registerTask('default', ['less']); 

}; 

CLI

$ grunt --version 
grunt-cli v0.1.13 
grunt v0.4.5 
$ grunt 
Running "less:development" (less) task 
File public/css/style.css created 

Running "less:production" (less) task 
File public/css/style.css created 

Done, without errors. 
+1

您需要將您的解決方案作爲單獨的答案發布(否則問題就不明顯了)。 – 2015-04-01 12:34:45

回答

1

這是我的壞...的CSS文件已經因爲less-plugin-clean-css的使用的壓縮。刪除它之後,可以通過參數compress再次管理壓縮。