Skip to content
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

Global styles missing from Windows Server build #4094

Closed
patrickoneill46 opened this issue Jan 18, 2017 · 7 comments
Closed

Global styles missing from Windows Server build #4094

patrickoneill46 opened this issue Jan 18, 2017 · 7 comments

Comments

@patrickoneill46
Copy link

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows Server 2012, version 6.2

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
(Windows server config)
angular-cli: 1.0.0-beta.21
node: 6.9.1
os: win32 x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Generated an app on my windows machine and my mac and when I run 'ng build' the global styles is generated and a link tag is added to the generated index.html.

However I am trying to generate a build on a windows server

The only significant changes to the config are -
Adding to angular-cli.json
"styles": [
"assets/styles.scss"
]
...
"styleExt": scss

The log given by the failure.

Normally this include a stack trace and some more information.

At the end of 'ng build' log output I see
'Process exited with code 0'

Mention any other details that might be useful.

In the logs from the build step, on both a Windows desktop machine and a Mac I see

chunk {0} main.f39f2b70462cbf4a98b0.bundle.js, main.f39f2b70462cbf4a98b0.bundle.map (main) 3.6 MB {1} [initial] [rendered]
chunk {1} styles.b2328beb0372c051d06d.bundle.js, styles.d41d8cd98f00b204e9800998ecf8427e.bundle.css, styles.b2328beb0372c051d06d.bundle.map, styles.b2328beb0372c051d06d.bundle.map (styles) 69 bytes {2} [initial] [rendered]
chunk {2} inline.d41d8cd98f00b204e980.bundle.js, inline.d41d8cd98f00b204e980.bundle.map (inline) 0 bytes [entry] [rendered]

On the build machine I see

chunk {0} main.13b4d333803f1cf29d7d.bundle.js, main.13b4d333803f1cf29d7d.bundle.map (main) 3.61 MB {1} [initial] [rendered]
chunk {1} styles.9851af0d1672bddf0116.bundle.js, styles.9851af0d1672bddf0116.bundle.map (styles) 3.39 kB {2} [initial] [rendered] not the styles[build-hash].bundle.csss is missing
chunk {2} inline.d41d8cd98f00b204e980.bundle.js, inline.d41d8cd98f00b204e980.bundle.map (inline) 0 bytes [entry] [rendered]

And the generated index.html is missing the style tag

All the other config is the default generated config


Thanks! We'll be in touch soon.

@clydin
Copy link
Member

clydin commented Jan 18, 2017

What version of the CLI are you using on the build server?

The behavior changed recently regarding the global styles bundle. Development builds (the default) will produce a javascript bundle instead of a css bundle. This can be changed by using the --extract-css option.

@patrickoneill46
Copy link
Author

On the build server the cli version is 1.0.0-beta-21.

Would it be worth upgrading?

@patrickoneill46
Copy link
Author

Tried updating and am encountering this issue - #4072

Reverted to beta-21 and still had the styles issue. It just doesn't seem to be including whatever is specified in the global styles config

@filipesilva
Copy link
Contributor

The CSS extract (creating a new .css file) options wasn't available in beta.21. You'll need to use the same version on your dev and build machine to get the same results.

Regarding #4072, fully follow https://github.com/angular/angular-cli#updating-angular-cli while upgrading and it should not happen.

@patrickoneill46
Copy link
Author

hi @filipesilva. Using the css extract flag was just a suggested solution and I immediately ran into the issue I linked.

The issue still occurs with the production build not including the global styles on the build machine with the exact same set up as dev machines. I can see the global styles file being picked up in build logs but they never seem to be included or applied by the browser.

I've followed the upgrading steps and it still isn't happening. Whether it is a production build or not, it should still pick up the global styles.

Can you offer any suggestions as to what to look into?

@filipesilva
Copy link
Contributor

@patrickoneill46 it really depends on the version you're using. It might have been a bug on the version you are using that was fixed in subsequent versions. I know it sucks to hear but in betas we can't promise support for anything but the latest one.

The best I can say is that on the latest versions, doing a production build does include the .css file, and that you can control whether or not you have a .css file for global styles via the --extract-css flag.

Regardless of whether you have the .css file in the final build, rest assured the CSS is there. When --extract-css is set to false, what happens is that there is a .js bundle that inject the CSS.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
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

3 participants