我正在尝试加载animate.css。这个包是使用命令安装的npm install --save animate.css。现在,在项目中导入它的最佳方法是什么?
我偶然发现了一些解决方案,要求将文件复制到静态文件夹中并从那里加载。但我宁愿不这样做,因为如果我们将它从它的包中移走,我们将失去 NPM 的所有好处。
假设您希望在应用程序中全局使用 animate.css
在你的webpack 中
module: {
loaders: [
{ test: /\.css$/, loader: "css-loader" }
]
}
Run Code Online (Sandbox Code Playgroud)
在你的main.js 中
import 'animate.css/animate.min.css'
Run Code Online (Sandbox Code Playgroud)