Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would you import .scss into .js?

I am trying to understand some JavaScript source code and at the top of the .js file I am seeing this:

import './style.scss';

I'm already confused. Sass is supposed to be converted to CSS. JavaScript and CSS are typically completely separate. Why would you import Sass into JavaScript?

like image 613
Sam Rueby Avatar asked Dec 06 '25 05:12

Sam Rueby


1 Answers

You might want to look into JSX and React: https://reactjs.org/docs/introducing-jsx.html

JSX is an extension of Javascript that allows you to add HTML code. You wouldn't import Sass into a javascript file, you would import it in a JSX file and use it to link an element to a particular className.

like image 163
AdeEla Avatar answered Dec 07 '25 19:12

AdeEla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!