CodeIgniter Forums

Full Version: How to concatenate and minify JS files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks,
I'm sorry if I'm asking a trivial question but I'm not an expert...

I have many JS files into my website that must be loaded into a single page. I know that generally is possible to concatenate and minify all files to make a single call to webserver but my question is:

Is possible to concatenate and minify JS files in CodeIgniter or more generally, how can I achieve this result? For more informations I have a webserver in which is not present Node.JS.

One alternative that I know is concatenate files with a 3rd party tool and then add a custom option in CI config to decide if files must be loaded one by one or the single merged but it would be a complete custom (and manually) procedure...
Hi there,
I am also interesting how to solve this problem.
Hi,
You can use to minifi js https://github.com/tedious/JShrink
You can simply concatenate minified js strings in PHP and save them to js file.
(02-02-2017, 09:13 AM)usmanikram Wrote: [ -> ]User Gulp http://gulpjs.com/

Here is a good tutorial: https://www.sitepoint.com/introduction-gulp-js/

Thanks, that is exactly what I was looking for.
..or you can try my library (https://github.com/avenirer/Assetor)...

Haven't updated it for quite some time but no one complained yet. The usage instruction can be found here: https://github.com/avenirer/Assetor/blob...r/USAGE.md