Removing media queries for non-supporting legacy browsers using node.js
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Very basic example of stripping media queries for old browsers (<IE9) using node.js fs

In search for a solution to this problem:

Test run

git clone the above files then:

node legacy-preprocessor.js

This should output a file legacy.css which you could include in your project using conditional comments:

<!--[if lt IE 9]><link rel="stylesheet" href="legacy.css"><![endif]-->

Potential expansions

  • Specify css file(s) or folder as a param
  • Rather than using the /*legacy*/ flag include param to specify a mq dimention as the selector
  • Update regex to capture entirety of the @media content rather than just one selector