I have Two Questions:
I have read the official docs, googled it, but faild to find the answers.
Please help.
Question 1
How to use both global style class and component-scoped style simultaneously?
like:
import "./layout.css"
import styles from "./hero.module.scss"
...
<section className={`hero is-medium` styles.backgroundImage}>
...
</section>
Question 2
How to use multiple global styles or multiple component-scoped styles simultaneously?
like:
import "./layout.css"
import styles from "./hero.module.scss"
...
<section className={styles.backgroundImage styles.fonts}>
...
</section>
Be very cautious with applying multiple classes like that when using css modules. CSS modules are meant to not mix classes, so you might hit issues when trying to combine multiple classes like that.
With that said - technically you can do that it like that:
import "./layout.css"
import styles from "./hero.module.scss"
...
<section className={`hero is-medium ${styles.backgroundImage}`}>
...
</section>
2.
import "./layout.css"
import styles from "./hero.module.scss"
...
<section className={`${styles.backgroundImage} ${styles.fonts}`}>
...
</section>
This is using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals that using backticks to declare a string and ${something} to insert "variables" inside
Most helpful comment
Be very cautious with applying multiple classes like that when using css modules. CSS modules are meant to not mix classes, so you might hit issues when trying to combine multiple classes like that.
With that said - technically you can do that it like that:
2.
This is using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals that using backticks to declare a string and
${something}to insert "variables" inside