purifycss / grunt-purifycss

Remove unused CSS with the grunt build tool
MIT License
163 stars 21 forks source link

Warning: Cannot read property 'forEach' of undefined Use --force to continue. #26

Closed DracotMolver closed 7 years ago

DracotMolver commented 8 years ago

This happend when I try to use it in grunt.

Config files is like this:

module.exports = function (grunt) {
    // Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        purifycss: {
            options: {},
               target: {
                  css: ['page/assets/css/style-modelos.css'],
                 dest: 'page/assets/css/dist/style-modelos.css'
               }
          }
     })

     grunt.loadNpmTasks('grunt-purifycss')

   grunt.registerTask('default', [
      'purifycss'
  ])
}
derekatkinson commented 7 years ago

I'm definitely answering this too late to be able to help @DracotMolver , but for anyone looking at this in the future: the src: line is missing. Your purifycss config should be:

purifycss: {
  options: {},
  target: {
    src: ['path/to/src.html']
    css: ['page/assets/css/style-modelos.css'],
   dest: 'page/assets/css/dist/style-modelos.css'
  }
}
DracotMolver commented 7 years ago

I realised that I didn't give you any clue lol. But thanks in advance :).