Bootstrap "grunt watch" will not create bootstrap.min.css

I'm almost brand new to grunt. I used grunt with bootstrap 3.1.1, and the command grunt watchworked just fine. My bootstrap.min.css file was compiled every time. (I load bootstrap.min.css file)

Later I lost the 3.1.1 grunt file (a long story that crashed my computer). So, now with Bootstrap 3.2.0, I was going to repair my workflow.

But now, when I use grunt watch, I get only "bootstrap.css" and "bootstrap.theme.css".

I spent the last hours to figure this out without success.

WHAT I WANT I want to grunt watchcompile the miniature "bootstrap.min.css" So, how can I call the min.css function on watch?

I will be happy to receive help.

+4
source share
3 answers

The Grunt watch will only look at files, and then run the tasks you set. I assume that in your grunt file you will have something like this:

css: {
    files: [
      'bootstrap.css',
    ],
    tasks: ['less'],
  },

In a smaller task, you should have something like below. Note that the parameter is cleancssset to true:

options: {
      cleancss: true
    },

    files: {
      "dest/bootstrap.min.css": "src/bootstrap.css",
      "dest/bootstrap.theme.min.css": "src/bootstrap.theme.css"
    }

UPDATE:

Based on the file you uploaded, you should run the task cssmin:corewhen the clock fires.

UPDATE 2: To update the view task, you can simply add the cssmin: core task to the smaller subtask:

less: {
        files: 'less/**/*.less',
        tasks: ['less', 'cssmin:core]
      }

, , cssmin, .

+7

gruntfile.js "",

    watch: {
      src: {
        files: '<%= jshint.core.src %>',
        tasks: ['jshint:src', 'qunit', 'concat']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint:test', 'qunit']
      },
      less: {
        files: 'less/**/*.less',
        tasks: 'less'
      }
    },
Hide result

, , , "grunt watch". Bootstrap 3.3.2 ( , 3.1.1 ) "cssmin", css. ,

    watch: {
      src: {
        files: '<%= jshint.core.src %>',
        tasks: ['jshint:src', 'qunit', 'concat']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint:test', 'qunit']
      },
      less: {
        files: 'less/**/*.less',
        tasks: ['less', 'cssmin']
      }
    },
Hide result
+1

. , css minification cssmin:minifyCore, :

watch: {
  src: {
    files: '<%= jshint.core.src %>',
    tasks: ['jshint:core', 'qunit', 'concat']
  },
  test: {
    files: '<%= jshint.test.src %>',
    tasks: ['jshint:test', 'qunit']
  },
  less: {
    files: 'less/**/*.less',
    tasks: ['less', 'cssmin:minifyCore']
  }
},

, !

0

All Articles