angular - Accessing shared styles from an Angular2 NgModule -
i have angular2 project (generated angular-cli
). in project have main module , sub-module. sub-module represents defined concept, fits have (potentially reusable) ngmodule
.
the sub-module encapsulates different components, , exposes 1 component outwards. nice, works module reusable.
however, module have 1 global dependency, stops being decoupled, reusable module. scss
file accesses common scss
file using @import
. common scss
file outside module.
so, specifically, scss
style file inside module refers scss
file outside module using relative paths, this:
@import './../../../assets/styles/common-props';
i don't want copy scss
file module. best way consume common scss
file, module becomes easy reuse? there best practice?
not sure if there best practice here. depends on how want import , manage external scss resources.
- if want scss resource updated homebrew or npm update importing source directory way go.
- if want manually control upgrade path scss resource move file scss hierarchy , import.
generally, prefer approach #2.
i have directory called 'libs' organize external scss / css files , import out of folder structure.
there edge cases use #1, rare.
Comments
Post a Comment