Ask Your Question
1

How can SCSS be imported dynamically in TypeScript?

asked 2023-06-06 17:59:10 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-06 18:16:02 +0000

david gravatar image

To import SCSS dynamically in TypeScript, you can use the require() function with the appropriate type declaration:

declare function require(module: string): any;

Then, you can invoke the function and pass in the path to the SCSS file as a string:

const styles = require('./styles.scss');

This will load the SCSS and make it available as an object that you can use in your code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-06 17:59:10 +0000

Seen: 15 times

Last updated: Jun 06 '23