bootstrap less grunt not working

时间:2014-02-02 15:14:56

标签: javascript twitter-bootstrap less gruntjs

我似乎无法使用我的gruntfile从bootstrap编译我的较少文件,这是我的gruntfile:

module.exports = function(grunt) {

  // Configuration goes here
  grunt.initConfig({
       less: {
        options: {
            paths: ["public/bower_components/bootstrap/less"]       
        },
        files: {
            "public/css/bootstrap.css" : "public/bower_components/bootstrap/less/bootstrap.less"
        }   
      } 
  });

  // Load plugins here
  grunt.loadNpmTasks("grunt-contrib");
  grunt.loadNpmTasks("grunt-contrib-less");

  // Define your tasks here

};

当我运行grunt less时,我得到了

Running "less:files" (less) task
Done, without errors.

Bootstrap有它自己的bru文件,它的bower安装,我不认为它会导致某种冲突?我已经三次检查了我的路径并且它们很好。

编辑:我的文件夹结构: enter image description here

由于

1 个答案:

答案 0 :(得分:1)

我的grunt less配置包含开发和生产目标的块。这有用吗?

module.exports = function(grunt) {

  // Configuration goes here
  grunt.initConfig({
   less: {
      development: {
        options: {
            paths: ["public/bower_components/bootstrap/less"]       
        },
        files: {
            "public/css/bootstrap.css" : "public/bower_components/bootstrap/less/bootstrap.less"
        }   
      } 
    }
  });

  // Load plugins here
  grunt.loadNpmTasks("grunt-contrib");
  grunt.loadNpmTasks("grunt-contrib-less");

  // Define your tasks here

};