4 ms·
Why would you minify your code during development? Isn't minified code for production?
by bkurtz13 12y ago
Why would you minify your code during development? Isn't minified code for production?
- nawitus 12y agoBecause minified code functions differently from non-minified code. It helps to detect bugs caused by minification. There's also a general principle which states that the application shouldn't be developed in a "debug" mode, because the debug mode might cause the application to execute differently from production.
- collyw 12y agoAs I understand it, minification is basically removing whitespace. Why would that make the code behave differently?
- jaredsohn 12y agoMinification can also involve changing variable names; sometimes there are dependencies on names that are unknown to the minifier. Also, the removal of whitespace can cause lines to combine in interesting ways if there aren't semicolons between them and if the minifier doesn't automatically add it. http://stackoverflow.com/search?q=minification+bug http://stackoverflow.com/search?q=minification+bug
- nawitus 12y agoJavaScript minifaction is much more than that. It renames function parameters, does all kinds of fancy tricks to refactor code and so on. AngularJS is one example where minifacation breaks the code if you don't use the "special" minification-safe pattern.
- ticviking 12y agoOn the off chance that whatever minification library you're using broke something somehow.