Still in progress...
Ever wander about multi css themes in your project? This is how easly you can do multi themes by dynamic generator. This is example project witch Angular 4.
Main scss files
- src/styles.scss - entry point of themer
- src/assets/themer.scss - theme CSS definitions
- src/assets/variables.scss - as its says
- src/assets/global.scss - global definitions based only on default variables map
- src/assets/mixins.scss - some extra mixins from me
- src/assets/forms.scss - global forms definitions
Files such as themer.scss, variables.scss and global.scss are necessary. Other files as mixins.scss or forms.scss are optional, and another varies can be add at its discretion.
Project has standard angular-cli methods.
- Pull repository
- Download dependencies
npm install
- Run project
ng serve
- Or build it
ng build
For more angular-cli documentation check Angular docs
- Add class
theme-default
tobody
element ofsrc/index.html
- Define maps of variables in
src/assets/css/_variables.scss
- Define variables in maps in
src/assets/css/_variables.scss
- Add defined maps (i.e.
$default
) to$themes
array insrc/styles.scss
- Add CSS whatever definitions to
src/assets/css/_themer.scss
The whole project is treated as example of use. You can build your own app based on this Angular architecture. Any changes designed by author (me) are about CSS, not JavaScript (or TS).