Skip to content

No styles.css file or docs unclear about global styles #1780

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

Closed
keithmichelson opened this issue Aug 20, 2016 · 11 comments
Closed

No styles.css file or docs unclear about global styles #1780

keithmichelson opened this issue Aug 20, 2016 · 11 comments

Comments

@keithmichelson
Copy link

keithmichelson commented Aug 20, 2016

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Mac OSX El Capitan
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    1.0.0-beta.11-webpack.2
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Build a new project with ng new filename --style=scss

The readme talks about a styles.css but there is no styles.css or styles.scss file for global styles created. If I need to create one manually I'm not sure where to do it or how it needs to be wired up to be included in the webpack bundle.

@penleychan
Copy link

From my understanding static files should go under public folder. When you do ng build it will get copied over to .\dist (I'm using angular-cli@webpack)

@keithmichelson
Copy link
Author

I can put a .css file in the public folder and link it in the index.html but I don't believe I can get a global .scss file working that way.

@iBasit
Copy link

iBasit commented Aug 20, 2016

+1

@iwoogy
Copy link

iwoogy commented Aug 22, 2016

I found this article about including global css with webpack and angular 2.
http://blog.assaf.co/angular-2-webpack-sass-and-viewencapsulation/

However I don't know how to configure webpack with angular cli.

Does anyone know how to do it ?

@martoncsikos
Copy link

martoncsikos commented Aug 22, 2016

+1

It's unclear how to use styles.scss for global styles (and potentially importing 3rd party scss) on 1.0.0-beta.11-webpack.2.

I believe the article posted by @iwoogy applies to the previous version of the CLI used with webpack, the webpack version doesn't seem to allow configuration of the webpack build like that.

EDIT:
#1633 seems related

@keithmichelson
Copy link
Author

@iwoogy Here is how you auto update to webpack https://github.com/angular/angular-cli/blob/master/WEBPACK_UPDATE.md
But you might want to wait until they get to that pull request.

@iwoogy
Copy link

iwoogy commented Aug 23, 2016

@keithmichelson Thanks for the link.

I actually create my project with :
angular-cli: 1.0.0-beta.11-webpack
node: 6.3.0
os: darwin x64

I never tried the content of this article :
http://blog.assaf.co/angular-2-webpack-sass-and-viewencapsulation/

However if there is a way to configure webpack it would be worth trying.

Since it does not seem to be a clear documentation on how to configure webpack for now, I will use node-sass to compile to the public folder.

The ultimate goal I'd like to achieve would be to have the same features that I have setup for my angular 1 projects about global css embedding :

  • compile from sass
  • fingerprinting
  • minifying
  • gzipped (ready for nginx to serve)

@filipesilva
Copy link
Contributor

filipesilva commented Aug 23, 2016

The readme is in a bit of a bad place right now: we're adding functionality for webpack but haven't cut a release in a week or so and a lot has changed. The styles.css file is part of the changes that haven't gotten a release yet, but it will be out soon.

Meanwhile you can use the master build as described in https://github.com/angular/angular-cli#development-hints-for-hacking-on-angular-cli, but I understand that's a bit of a hassle so my advice for global styles is to wait for the next webpack release.

@keithmichelson
Copy link
Author

@filipesilva Ahh, okay thanks for clearing this all up. Glad you are aware of it all, does that include global .scss as well?

I can wait a bit, but hopefully not too long :) Thanks for the work on this, it will be really nice to use.

@filipesilva
Copy link
Contributor

Yeah you can use global css/sass/less/stylus, it should just work.

@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

6 participants