Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing minified javascript

Should we test the minified versions of our javascript files as we develop them, or is it an extremely low risk that the minified javascript does not differ in function from the un-minified version?

like image 382
readonly Avatar asked Feb 04 '23 06:02

readonly


2 Answers

Running your test suites against them should be enough.

...

You do have test suites... right?

like image 65
Ignacio Vazquez-Abrams Avatar answered Feb 05 '23 19:02

Ignacio Vazquez-Abrams


Run them through jslint before minifying them and if they pass that they should minify without a problem. The key here is to not forget a ; since minifying will remove all linefeeds. Also declaring variables helps the minifying process, but not doing so will not break anything by minifying.

like image 43
Svante Svenson Avatar answered Feb 05 '23 20:02

Svante Svenson