I'm using carabiner for CodeIgniter which can minify all the javascript files it loads. Well, I have about 10 files that work fine, then when minified, they don't... I'm not sure exactly what doesn't work, there are no errors, just certain features that don't work. Is there any particular reason why minifying JavaScript would cause it to not work?
To regain space and improve your page load speed, you must minify the JavaScript code. The minified version of JavaScript code can reduce the file size by as much as 30–90%. Consequently, JavaScript minification has become a familiar ritual for all developers.
The main purpose of JavaScript minification is to speed up the downloading or transfer of the JavaScript code from the server hosting the website's JavaScript. The reason that minification makes downloads go faster is because it reduces the amount of data (in the minified JavaScript file) that needs to be downloaded.
Maybe you can try by checking how long the lines are, and how many spaces are used. Minified/packed JS typically has almost no spaces (typically in strings) and very long lines.
Open any web site. Open developer tools in chrome by pressing F12 /Ctrl + Shift + I/ right-click anywhere inside the web page and select Inspect/Inspect Element which will be mostly the last option. Go to Sources tab in developer tools and open any minified JS which you want to debug as shown in the image.
You may want to try running JSLint on your Javascript code before you try to minimize it. JSLint might highlight some issues, which could allow you to minimize your code without error.
Or you may want to try another 'minification' tool.
Here are two articles I've found on 'A List Apart,' that may interest you, looking at the YUI Compressor.
"Better JavaScript Minification"
"JavaScript Minification Part II"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With