javascriptgruntjsgrunt-contrib-cssmin

How to disable grunt-contrib-cssmin combine?


I have three files:

'selectize.default.css'
'selectize.pagination.css'
'selectize.patch.css'

and I want to minimize them.

Here is my gruntfile:

cssmin: {
     min: {
         files: [{
             expand: true,
             cwd: 'css',
             src: [
               'selectize.default.css',
               'selectize.pagination.css',
               'selectize.patch.css',
               '!*.min.css'
             ],
             dest: 'release/css',
             ext: '.min.css'
         }]
     }
}

Problem is there is only one file named selectize.min.css I don't want it to minimize only one file. How can I minimize all three of them?


Solution

  • If I understand your question correctly, you want to minimize the files, but not combine them into one? In that case, my recommendation would be to make separate calls for each file. e.g.:

    cssmin: {
         default: {
             files: [{
                 expand: true,
                 cwd: 'css',
                 src: [
                   'selectize.default.css',
                 ],
                 dest: 'release/css',
                 ext: '.min.css'
             }]
         },
         pagination: {
             files: [{
                 expand: true,
                 cwd: 'css',
                 src: [
                   'selectize.pagination.css',
                 ],
                 dest: 'release/css',
                 ext: '.min.css'
             }]
         },
         patch: {
             files: [{
                 expand: true,
                 cwd: 'css',
                 src: [
                   'selectize.patch.css',
                 ],
                 dest: 'release/css',
                 ext: '.min.css'
             }]
         },
     }
    

    It probably isn't the cleanest way, but it will do what you want. I haven't test this code, so be warned I don't know that it works.