How to use Grunt while continually compressing css / javascript
Tags: javascript,css,gruntjs,grunt-contrib-cssmin
Problem :
I am just getting started with Grunt so please excuse a question which may be dumb:
If I am using cssmin or uglify or any other plugin that alters the appearance of my code:
How do I make it so that the reference in my main.html
file stays consistent. In other words, obviously I am going to develop with an uncompressed css file (let's call it style.css
). If I am referencing that in my main.html
as <link rel=stylesheet src="main.css">
but grunt consistently minfies it to main.min.css
it seems like everytime, after I run grunt, I am going to have to go into my main.html
and change the link reference (which would be annoying because I have to update git each time too.
I could configure cssmin to overwrite my style.css
with the same file name but then it would be almost impossible for me to modify. Is there a way around this?
Solution :
These plugins will help: grunt-useref, grunt-processhtml.