Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Marty Hitchcock
Marty Hitchcock
13,108 Points

How to use concatenated files for production only

I am currently using Grunt to concat my css files each time I do a git commit. However, that means between commits when I am working on something I will not be able to see the changes.

Is there a way to change between:

<link href='css/production.css' rel='stylesheet'>


<link href='css/header.css' rel='stylesheet'>
<link href='css/app.css' rel='stylesheet'>

I can get the trigger as to WHEN to make the change, I just don't know HOW to change the links.

Can I hear some explanations on how other people change their concatenated files etc between development and production? Unsure if i'm doing it right.

David Bath
David Bath
25,940 Points

I don't know how you would do that without using a Grunt plugin like usemin, which will replace the lines in the HTML like you want. But that seems more complicated than is necessary. Why don't you just set up a watch task in the Gulpfile that will run the css concatenation whenever you save a file?

Marty Hitchcock
Marty Hitchcock
13,108 Points

Yeah I thought about that but seemed over kill to constantly run a command prompt window just for that and there must be an easier way. But I guess it is just one of those things.