Load scss from js file

Asked

Viewed 68 times

0

I am working on a static website, where I have the following directory structure:

/
  /src
    exemplo.scss
    exemplo.js
  index.html
  webpack.config.js

In my exemplo.js i give a require('exemplo.scss'), which in turn loads the bootstrap. The webpack generates a file index.js, in this file I can see all bootstrap classes (which were loaded from the exemplo.scss), but bootstrap classes are not applied in index.html.

Obs: webpack, webpack-cli, bootstrap, css-loader, scss-loader etc. installed. No error is generated in the console or log. I am importing the file index.js generated by the webpack in my index.html. You can see all bootstrap classes in the file index.js generated by the webpack, but it is not possible to use the classes in the index.html.

1 answer

0

I bet your problem is with the packages you’re installing wrong, you installed scss-lodaer actually should be sass-loader, and you need to use the style-loader along.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.