If you use a Javascript bundler - like web pack - and you're creating your production ready JS and CSS it is likely that you will use Post-CSS, CSS Loader etc..  In this tutorial I will go over some basic configurations to enable and disable some default behavior, like enabling IE Grid and disabling auto z-index optimizations.  For a list of some of the features you can enable/disable in Post-CSS you can check out this file, https://github.com/MoOx/postcss-cssnext/blob/master/src/features.js.

Enabling IE Grid  

If you use CSSGrid and you use IE (yuk) then you will want to enable the IE Grid - this is turned off by default.  To do this you can pass this object into the post-CSS constructor:


Disabling Z-Index

PostCSS uses the CSS-Nano plugin to perform several CSS optimizations.  One of these is a z-index cleanup.  So if you have two classes with a z-index of 1000 and 15000, CSS-nano will tidy this up to have a z-index of 1 and 2.  This optimization is slightly quicker but it can break your site.  You can disable this feature, however, as you can config web pack in many different ways, there seem to be multi-ways to achieve this.  When I fixed my build there didn't see to be a definitive list on the internet, so here goes.  If you reference CSS-Nano directly, then you can just pass this object into the constructor:

If you use CSS Loader, then you might need to add this into the optimizations section, like this:


Also, you are meant to be able to pass in {safe:true} directly to the Post-CSS constructor, this is probably the nicest way but it did not work for me.


There are definitely a few different ways to enable and disable the z-index, so hopefully one of these works for you!