【问题标题】:bootstrap less grunt not working引导较少的咕噜声不起作用
【发布时间】:2014-02-02 15:14:55
【问题描述】:

我似乎无法让我的 gruntfile 从引导程序编译我的 less 文件,这是我的 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 有它自己的 grunt 文件,它的 bower 安装附带,我不认为它会导致某种冲突?我已经三次检查了我的路径,它们都很好。

编辑:我的文件夹结构:

谢谢

【问题讨论】:

  • 您能发布您的文件夹结构以及保存 gruntfile 的位置吗?似乎您对文件的来源有一些问题。
  • 嗨 Slawa,我已经发布了我的文件夹结构,gruntfile 在底部附近。
  • 不是创建结果文件,还是部分创建文件等?
  • 我不认为你需要 options.paths 这里。
  • @helion3 它根本没有创建它

标签: javascript twitter-bootstrap less gruntjs


【解决方案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

};

【讨论】:

  • 虽然你的路径是正确的,但我似乎收到了这个错误>> No "less" targets found. Warning: Task "less" failed. Use --force to continue. Aborted due to warnings.
  • 糟糕,将块添加到错误的位置。刚刚编辑交换lessdevelopment的顺序...
猜你喜欢
  • 1970-01-01
  • 2013-10-17
  • 2015-01-05
  • 2014-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多