huan feng
huan feng

Reputation: 8623

How should i import the sass files in angular

For example, I have scss files structure like below:

src
 | - assets
        |
        | - scss
             |
             | - patials
                    | - _variable.scss
                    | - _flex--layout.scss
                    | - _button.scss

And all the partials have been imported in the styles.scss:

styles.scss

@import 'app/styles/normalize';
@import 'app/styles/variables';
@import 'assets/scss/_loading';
@import 'assets/scss/partials/_color.vars';
@import 'assets/scss/partials/size.vars';
@import 'assets/scss/partials/utils';

Question: If a component used both _variable.scss, _flex--layout.scss and _button.scss in its xxx.componenet.scss, should i @import the styles.scss once,

@import '../../../styles.scss';

or I should import all the partials needed like below:

@import '../../../assets/scss/partials/_color.vars';
@import '../../../assets/scss/partials/size.vars';
@import '../../../assets/scss/partials/utils';

Upvotes: 1

Views: 63

Answers (2)

Vijay Prajapati
Vijay Prajapati

Reputation: 758

You can try this - > Go to style.scss and import

@import '../src/assets/scss/patials/_variable.scs';
@import '../src/assets/scss/patials/_flex--layout.scss';
@import '../src/assets/scss/patials/_button.scss';

ANS - Only Import In style.scss effect all over project

Upvotes: 2

Ravin Singh D
Ravin Singh D

Reputation: 893

@import '../../../styles.scss';

This should be enough.

Upvotes: 1

Related Questions