In an older version of cssmin it was possible to create to different target files. I minified a style.min.css and an above-the-fold.min.css. Now I updated to a newer version of nodejs, npm, grunt and cssmin and it is not possible to minify to different outputfiles anymore. Since the update grunt only minifies the second task and skip the first task. Do you have a hint for me to minify both tasks?
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'data/style.min.css': ['a.css', 'b.css', 'c.css', 'd.css', 'e.css', 'f.css', 'g.css']
}
}
},
penthouse: {
extract : {
outfile : 'data/above-the-fold.temp.css',
css : './data/style.min.css',
url : 'http://localhost/',
width : 1280,
height : 500
},
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'data/above-the-fold.min.css': ['data/above-the-fold.temp.css']
}
}
}
grunt-contrib-cssmin will allow multiple Targets to be defined in a single Task. For example:
Gruntfile.js
Each Target name should be unique within the
cssminTask. For example:targetAandtargetBAs you've included the
penthouseTask in your post, I guess that you need to run that after generating thestyle.min.cssfile, and before generating theabove-the-fold.min.css. To do this you can register your Tasks as follows:Note: The use of the semi-colon notation, namely
cssmin:targetAandcssmin:targetB. This simply ensures thattargetAof thecssminTask is run before thepenthouseTask. Subsequently, (when thepenthouseTask completes),targetBof thecssminTask is run.