1
votes

So, I am still pretty new to this, but I am using a yeoman generator for my projects, specifcally this one https://github.com/DaftMonk/generator-angular-fullstack. What I am trying to accomplish is having angular load in in the TOP of the index.html, instead of in the group with the rest. I basically am trying to get ng-cloak to work for my app loading, and cannot seem to accomplish this correctly without having the angular script loaded in up in the head, otherwise it shows the unrendered html.

I'm wondering if there is a way to do this with the grunt (possibly bower?) set up? I am using their grunt file - seen here https://github.com/DaftMonk/generator-angular-fullstack/blob/master/Gruntfile.js. Also - when I grunt build, can I keep it in the top of the document (instead of piled in with the minified js at the bottom again). I think I'm even ok if it doesn't get minified in with the other scripts, as long as it stays up top.

If someone could point me in the right direction I would REALLY appreciate it, I've been digging through the grunt and bower stuff for a few hours now :(.

Thanks for reading!

1

1 Answers

1
votes

Don't know the generator produced Gruntfile, and unfortunetly don't have time to check out what its doing to inject your scripts. What I use is wiredep (though I'm a gulp guy) and, with that you just place a template comment on where to inject, so you can do it in the head. The angular docs do say though that if you are inserting the angular script in the body you can still make use of ng-cloak by simply defining the display none on the the ng-cloak class in your stylesheet. I didn't have success with that though :) Not much of an answer, though you probably already figured something out as you asked this 6 days ago. I would figure out what the generated bower file is using to do your bower dependency injections, but if it outputs those comments in your index.html like or something like that, just move that to your head (it will load all your vendor scripts there. On a side note, you may just want to concatenate those to save connections back to the server.