Using grunt to compile sass, concatenate and minify, I discovered z-index entries were being set to 1.
This is a known issue with cssnano. See https://github.com/ben-eb/gulp-cssnano/issues/10 and https://github.com/ben-eb/gulp-cssnano/issues/14.
In the readme for cssnano, it says:
Note that cssnano enables aggressive optimisations by default, which might not always be what you want. Set `options.safe` to `true` if you want to disable this. In future versions, only safe options will be enabled by default, starting from [version 4][v4].
This is how you set options.safe to true if you are using grunt.
postcss: {
options: {
map: true, // inline sourcemaps
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')(), // add vendor prefixes
require('cssnano')({ "safe": true }) // minify the result
]
},
dist: {
src: 'css/style.css',
dest: 'style.css'
}
}
If I just saved you an hour of mucking around, please let me know in the comments!
Leave A Comment