简体   繁体   中英

CSS @import “~materlize-css” | Using Webpack | No style being made

I'm using Sage, a WordPress framework, and it lets you choose during creation some css frameworks, but I want to use Materialize CSS instead.

It uses Webpack to build and combine the .scss files into one. I did an npm install materialize-css so it's in my node_modules . In my project structure, I made an scss file that's used to import the module basically.

I also have bulma in this build, included via the original creation, so I can try to see how the structure is setup. It uses the following import statement:

@import "~bulma";

This works. I'm so confused about how this works. I think the ~ (tilde) tells Webpack something, but I don't know what. What I figured is that Webpacks checks the package.json file or something and finds it in the node_modules.

I've tried @import "~materialize-css"; with no luck.

Can someone explain what the heck Webpack is doing? Haha, because I can't find any documentation on this.

Here are the node_module folder structures, maybe this has something to do with it:

节点模块文件夹结构

Perhaps the root of Bulma is bulma.sass yet for Materialize-CSS, there's no file, it's in sass/materialize.scss .

If needed, here's the github for the Sage framework, the webpack.config.js is in the build folder: https://github.com/roots/sage/tree/master/resources/assets

You have to specific the file you want to import also like this

@import "~bootstrap/scss/bootstrap";
@import "~font-awesome/scss/font-awesome";
@import "~toastr/toastr";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM