I have a lot of CSS & JS files in my html, and i'm using YUI Compressor to minify & concat all of these into 1x CSS and 1x JS.
Is there a way for maven to go into my HTML file, remove the 20+ lines of & includes and replace with the one that is minified ?
A good option is to use Grunt to replace the references within your html file. There is a Grunt plugin to do this: the grunt-usemin.
For example:
<!-- build:js js/app.minjs -->
<script src="js/controllers/thing-controller.js"></script>
<script src="js/models/thing-model.js"></script>
<script src="js/views/thing-view.js"></script>
<!-- endbuild -->
The output file:
<script src="js/app.min.js"></script>
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