Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Failing to load styles when I run test task while running a server #174

Closed
brnrdog opened this issue Oct 4, 2013 · 14 comments
Closed

Failing to load styles when I run test task while running a server #174

brnrdog opened this issue Oct 4, 2013 · 14 comments

Comments

@brnrdog
Copy link

brnrdog commented Oct 4, 2013

I changed the port of the task test to a different one from the server task to run both at the same time. It works, but when I run the test task, the server fails to load the styles, getting 404 error. Is there a way to resolve this?

UPDATE

It seems that tasks like grunt test clean our .tmp directory and doesn't build it up back. It would be awesome if we could get our .tmp back at the end of grunt test task.

@ecurtis
Copy link

ecurtis commented Oct 6, 2013

I am seeing the same thing. On both building and just running server the main.css file is not being genereated. For example.tmp/styles/ is empty when doing a fresh install and grunt server.

On OS X here if that makes a difference.

@ryan-w-moore
Copy link

I too am getting a similar outcome. After successfully running 'yo webapp' and then 'grunt server' I get the index.html file loading in my browser but void of any sign of a stylesheet, there is a reference in index.html to main.css but the file is empty. Assuming that the .scss is compiled into main.css I can only theorize that running 'grunt server' is not compiling Sass to CSS ?
is the compilation of .scss files an actual task in the grunt server task list file? (I am uncertain as of this moment where that task file is located for 'grunt server'.)
I have recreated this same event/error 4x times, following the exact instructions and on-screen commands as Addy demonstrated in his new (and always awesome! btw) yeoman article: "5 Minutes with Yeoman". http://addyosmani.com/blog/5-minutes-with-yeoman/
The article includes the video, entitled "Getting started with Yeoman and generator-webapp" here: http://www.youtube.com/watch?v=rYwJ5-esSYE
and having followed the workflow I cannot see how I am not getting the same results - the following screenshot is what is created after running '$ grunt server'
screen shot 2013-10-07 at 1 35 28 am

@brnrdog
Copy link
Author

brnrdog commented Oct 7, 2013

That's weird. Maybe a stupid question, but do you have sass installed?

My problem (and @ecurtis problem, I presume) is only when I run grunt test when there is a server running with grunt server. It seems that tasks like grunt test clean the styles temporary directory, losing my compiled css files (which I must say that makes sense).

@brnrdog
Copy link
Author

brnrdog commented Oct 7, 2013

I figured out why. Tasks like test clean our .tmp directory, which includes our styles compiled. It would be awesome if grunt testbuild up .tmp back.

captura de tela 2013-10-07 as 03 15 06

@ryan-w-moore
Copy link

Interesting that you ask @bernardogfilho , It is certainly not a stupid question since I am attempting this without knowing or ever using SASS, or LESS, I would have assumed it to be installed as a dependency or initialized a warning once completing the yo webapp command...but no, I don't think I do. How would I go about installing SASS?
As a dependency using bower? or npm? or some other suggestion? (sans the ultimate suggestion that I learn what things are and how they are used before playing with them. - it's a logic I am conscientiously ignoring to try and push myself past my line of comfort and experience to see whats out there that I do not know, so that when I retract and go back to my skill-level arena I can at-least say I jumped the fence and know whats ahead of me. . .

@ecurtis
Copy link

ecurtis commented Oct 7, 2013

Found the fix, it is an error in bootstrap or sass bootstrap.

In /app/bower_components/sass-bootstrap/lib/_grid.scss you need to replace the m-dash with hyphens and then it will compile and copy. It was not a problem with test.

References:
jlong/sass-bootstrap-defunct#103
twbs/bootstrap#10336
twbs/bootstrap@604c3b2

@brnrdog
Copy link
Author

brnrdog commented Oct 7, 2013

Actually, I have no problems with a grunt server or grunt build task.
My problem is that I want grunt test to build back my .tmp directory, since it cleans up at the beginning.

@ecurtis
Copy link

ecurtis commented Oct 7, 2013

Yup, I noticed that there was sass error that was preventing the generation of the main.css file in .tmp for me

I do not think it is the grunt test cleaning it out, I think it never generates.

All fixed and working now here. Good luck.

@brnrdog
Copy link
Author

brnrdog commented Oct 7, 2013

@ryan-w-moore You need to install Ruby, and then install the sass gem. You can follow the instructions at their website http://sass-lang.com/download.html

@christianboyle
Copy link

Had the same issues as noted above. Tried everything people suggested, but nothing worked. Noticed nodejs was out of date, updated per http://davidwalsh.name/upgrade-nodejs and everything worked as expected after starting from scratch and following the steps in http://addyosmani.com/blog/5-minutes-with-yeoman/

@robwierzbowski
Copy link

Re: test task: In the Yeoman workflow, test is a standalone task, not meant to be run alongside server. You can edit it a bit so that it uses server assets (we've done that on our application, more familiar for the Rails devs), but then it will require server to be running, and the default grunt task won't work as it does now.

Six of one, half dozen of the other.

@haydenbleasel
Copy link
Contributor

@ryan-w-moore @christianboyle Yeoman + Grunt usually requires Compass as it carries SASS as a dependancy, so try gem install compass. This isn't the issue though and I'm pretty sure @ecurtis is right. There's no trace of Bootstrap, CSS or otherwise, in the dist directory.

UPDATE 1/11/13

@ecurtis The whole "non-ASCII dash" thing was fixed as of Bootstrap's 3.0.1 release (see the Release Plan) which is included in yo webapp, but I'm still missing the Bootstrap CSS after grunt or grunt server. Has anyone legitimately solved this issue?

@brnrdog
Copy link
Author

brnrdog commented Nov 1, 2013

Thanks for your reply @robwierzbowski (:
I noticed that is the way the yeoman workflow works, which actually makes sense.

I'll close this issue for now.

@hectorpalmatellez
Copy link

In my case I solved this by running grunt compass, which I didn't have to do with other generators, since I already had all these gems installed. Still, it's weird that it didn't make the stylesheet when I made grunt build or grunt server 👎

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants