简体   繁体   中英

bootstrap less grunt not working

I can't seem to get my gruntfile to compile my less files from bootstrap, here is my 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

};

When I run grunt less I get

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

Bootstrap has it's own grunt file that comes with its bower install, I don't suppose it would cause some sort of conflict? I have triple checked my paths and they are fine.

EDIT: my folder structure: 在此处输入图片说明

Thanks

My grunt less config has blocks for the development and production targets. Does this work?

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

};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM