-
Notifications
You must be signed in to change notification settings - Fork 12k
[Bug] Inconsistent parsing of Component styleUrls
fails CSS loading
#1501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just wanted to report this as well. Same happens with // Update: Hmm...it's kinda related, but by re-verifying I guess my issue is different. Going to try to reproduce it // Update 2: Filed a new one #1502 |
This I believe is fixed in an underlying node module. I'll make the change to fix this. This issue is related to my angular2-template-loader |
In fact, I figured this might be something related to some loader module rather than the CLI, but wasn't sure. Thx for taking care, I'll follow closely 😃 |
Btw, any idea about issue #1502 I reported? If have a hint where to look for I can definitely try to fix it |
@TheLarkInn we still need a release |
Yes I need to make sure that is fixed and then I'll cut a release. |
Can confirm this behavior as well. @TheLarkInn when can we expect the fixed Thanks. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
in a Terminal:
node --version
and paste the result here:Open
http://localhost:4200
in browser.Open
app/app.component.ts
in code editor.Change
styleUrls: ['app.component.css']
tostyleUrls : ['app.component.css']
.Did you see the difference?
styleUrls:
becomesstyleUrls :
. We add a single space!Go back to the browser, see the app fail. In the console you see:

You can fix this by prepending
app/
to the styleUrl path, so the line becomes:styleUrls : ['app/app.component.css']
Except, now if you delete the extra space, changing
styleUrls :
tostyleUrls:
, you'll get the same error again, and you have to remove theapp/
path prefix for it to work again.This is confusing, so a summary:
styleUrls: ['app.component.css']
<- ExpectedstyleUrls : ['app/app.component.css']
<- What?!styleUrls : ['app.component.css']
<- What?styleUrls: ['app/app.component.css']
<- ExpectedTry it.
more information.
In browser console:
If you run the Angular 5 minutes demo in Plunker, and add a
app/app.component.css
file to it, then try to add it to the AppComponent, you'll find the following combination:styleUrls: ['app/app.component.css']
styleUrls : ['app/app.component.css']
styleUrls: ['app.component.css']
styleUrls : ['app.component.css']
This shows 2 things:
The whitespace does NOT make a difference,
BUT, the path needs to be root relative, not component relative.
(Try here)
My personal guess is that this is related to Webpack change, although I haven't tested it in systemJS folder, but it was mentioned in #1459 (comment) that the Webpack version only uses a raw loader to work with the CSS files. Maybe it's a regex that needs fixing, or better strategy. Note sure.
The text was updated successfully, but these errors were encountered: