问题描述
我正在编写一个使用Webpack的客户端应用程序,但我不知道如何要求materialize-css软件包.我正在使用 Henrik Joreteg的hjs-webpack包,与此同时,Yeticss的npm包也包含在其中在sass文件(例如@import 'yeticss'
)中进行导入,但这不适用于实现.像其他任何软件包一样,直接在代码中(例如JS文件中的import 'materialize-css'
)直接要求它也不起作用.
I'm writing a client-side app that is using Webpack, and I cannot figure out how to require the materialize-css package. I'm using Henrik Joreteg's hjs-webpack package, and with this the yeticss npm package is included by doing an import in a sass file (e.g. @import 'yeticss'
), but this doesn't work for materialize. Requiring it straight up in the code (e.g. import 'materialize-css'
in a JS file) like any other package also doesn't work.
推荐答案
在这种情况下,与Yetics不同,您需要进入并要求使用特定文件,而不仅仅是软件包名称,因此:
In this case, unlike with yeticss, you need to go in and require the specific files, rather than just the package name, thus:
import 'materialize-css/dist/css/materialize.min.css'
import 'materialize-css/dist/js/materialize.min.js'
这篇关于如何在Webpack中包含materialize-css npm软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!