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! While you're at it, check out some resources Treehouse students have shared here.

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

Development Tools

Bruno Dias
Bruno Dias
10,554 Points

Beautify html on Yeoman

Hi guys,

I am trying to generate an app using Yeoman. When I run grunt build everything works fine, the dist directory is generated with no issues.

However my problem is that Yeoman is generating uglified html file. Is there a way to change to a beautified html?

Bruno Dias
Bruno Dias
10,554 Points

Ok, I figured it out myself.

I changed to false all the options on htmlmin.

Hey Bruno. Seems like you got what you wanted figured out, but just to let you know, you usually want your code in your dist directory to be uglified (because it takes up less space therefore downloads faster).

So when you are developing, you just edit your files in the main directory (which you write in beautified form) and then grunt build will uglify that code so that it is lightweight when it goes on a server in production.

Bruno Dias
Bruno Dias
10,554 Points

Hey Nick,

Thanks for clarifying. In my case I need to generate the dist folder in order to pass it to back-end team and they will need to manipulate the html files. That's why I need a beautified html. Does that make sense?

OK, in that case, you probably don't want to do that. What you probably want to do is just have the back end-guys edit your code from your main directory and then run grunt build with all their changes in place, which will minify everything, including the code the back-end guys wrote.

If you change anything directly in the /dist directory, it will be overwritten the next time someone runs grunt build. That's because one of the first grunt tasks executed in the Yeoman build is a clean task, which pretty much wipes everything out of the dist folder to start fresh.

I would say in general, you rarely ever want to change anything inside the /dist directory manually. Not only will it be gone the next time you run grunt build, but none of the code inside /dist gets tested (unit tests or JSHint).

Bruno Dias
Bruno Dias
10,554 Points

Oh I see, that make sense now. They should manipulate the app folder instead.

Right.

Bruno Dias
Bruno Dias
10,554 Points

Nice! Thank you so much mate.

I am facing another issue with yeoman but will open a new post though.