1.0.0 • Published 7 years ago

static-component-webpack-plugin v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

#static-component-webpack-plugin webpack静态组件插件

//webpack配置
module.exports = {
module: {
        loaders: [
            {test: /\.css(\?cpt=\w+)?$/, loader: "style!loader")},
            {test: /\.js$(\?cpt=\w+)?$/, loader: "babel")},
            {test: /\.html(\?cpt=\w+)?$/, loader: "html"}
        ]
},
plugins: [
        new Plugin({
            filename: 'home.html',//输出文件
            template: 'index.html'//模版文件
        })
    ]
}

//引入文件
import './head.html?cpt=head'
import './foot.html?cpt=foot'

//在模版文件中
<html lang="en">
<body>
<%=head%>
<%=foot%>
</body>
</html>