0.0.7 • Published 5 years ago
html-webpack-render-plugin v0.0.7
HtmlWebpackRenderPlugin
Webpack模板渲染插件, 基于HtmlWebpackPlugin; 目的是解决Webpack工程体系中,本地模板引擎的灵活配置及选择
已支持模板引擎
- smarty(php模板引擎)
- velocity(java模板引擎)
安装方式
npm i --save-dev html-webpack-render-plugin
yarn add --dev html-webpack-render-plugin
使用方式
webpack.config.js
{
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
title: 'My App',
filename: 'assets/admin.html'
}),
//默认velocity
new HtmlWebpackRenderPlugin(),
]
}
注意事项
每个模板文件都需要对应的mock.js文件(例如:)
.
├── index.js
├── index.less
├── index.mock.js
└── index.vm