I've been looking at the project structure in the Angular style guide (angular.io). Everything they recommend seems to make sense, but I'm confused about 1 thing: where would you put common CSS
in this structure?
By common CSS
, I'm talking about things like Sass partials that you want to import into multiple other CSS
files. Or even for the HTML
, too, if you are using a template language.
Global CSS — The Way You're Used To Angular components can be styled via global CSS the same as any other element in your application. Simply drop a `<link>` element on your page (typically in index. html) and you're good to go!
To create an internal stylesheet, you place CSS inside a <style> element contained inside the HTML <head> . In some circumstances, internal stylesheets can be useful. For example, perhaps you're working with a content management system where you are blocked from modifying external CSS files.
Go to angular. json file, under styles add stylePreprocessorOptions object with includePaths option and define all paths available in an array with your file paths, it should be relative to the angular.
If you create your project using angular cli you will find a file styles.css
under src
folder. Put all your common styles in this file.
.angular-cli.json
file mentions this file to be bundled as a style
"styles": [
"styles.css"
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With