简体   繁体   English

如何使用单个实现的CSS组件

[英]How to use individual materialize css components

I've installed materialize-css using npm . 我已经使用npm安装了materialize-css。
https://materializecss.com/ https://materializecss.com/
How can I import individual components (like button, navbar) instead of the full build? 如何导入单个组件(如按钮,导航栏)而不是完整版本?
I'm using webpack as well. 我也在使用webpack。
I see files such as buttons.js , but I can't import them. 我看到了buttons.js文件,但无法导入。 Also obviously I want to set up minification for the components that I use. 同样显然,我想为我使用的组件设置最小化。

The easiest way to get whatever component you want to include is to setup your build using SASS/SCSS. 获取要包括的组件的最简单方法是使用SASS / SCSS设置构建。 That way choosing which component you want is as simple as including an @import statement like: 通过这种方式选择所需的组件就像添加@import语句一样简单:

@import "components/buttons";
@import "components/grid";
@import "components/datepicker";

But if you dont want to learn SCSS syntax, try this: http://materialize.khophi.co 但是,如果您不想学习SCSS语法,请尝试以下操作: http : //materialize.khophi.co

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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