Mihir Shah
Mihir Shah

Reputation: 988

Can more than one scss be used for one SPFx Web Part?

I am new to The SharePoint Framework (SPFx). I am trying to convert old Content Type Web Part into SPFx Web Part. Earlier we have used multiple css files and included into html page. But for SPFx Web Part, I got stuck for how to use more than one scss for one Web Part. I searched but found suggestions on how to give give names of scss for your Web Part but no where i found like it allows only one scss or something.

So i would like to know whether it is possible to have multiple scss file for one web part or not? And if yes then how?

Upvotes: 1

Views: 673

Answers (1)

Rune Sperre
Rune Sperre

Reputation: 126

This should be quite easy to accomplish. Just add a new .module.scss file to your solution and reference it with a unique identifier.

Example:

import styles from './Existing.module.scss'; // this is the one you already have
import additionalStyles from './Example.module.scss'; // your new module

Then you can reference these like <div className={additionalStyles.awesomeClass} />

Upvotes: 1

Related Questions