Is it possible to have PhpStorm automatically combine JS files after minification?
I'm using filewatchers with the YUI compressor to compress JS & CSS files. I like to break up these types of files instead of having a single massive file, but I want to combine some of them to reduce the number of HTTP requests browsers have to make when loading my website.
Is there a way to have PhpStorm combine certain files and put the output into a new file automatically after minifying them?
For example, let's say I have these files:
common.js
account.js
blog.js
forum.js
And the first three are loaded throughout the entire site, so it makes sense to put them together to avoid three HTTP requests:
common.min.js + account.min.js + blog.min.js => global.min.js
If this simply isn't possible in PhpStorm, do you have any suggestions on how to deal with this?
Please sign in to leave a comment.
Hi there,
Create another file watcher that will watch for changes in those minified files .. and when detected will run your combining script.
Such "combining script" could be anything:
---
Another option is to have single file watcher for both of these steps: instead of just minifying first and then combining (separately) ... why not minify & combine at the same time. For this you need to write your own simple script/task that would do these steps and use it in File Watcher.