我是webpack的新手,试图弄清楚如何在webpack-dev-server和我的webpack版本中使用自己的html文件.
I'm new to webpack and trying to figure out how to use my own html file in the webpack-dev-server, as well as my webpack build.
在我的app.js中,我有:
in my app.js I have:
require('!jade!index.jade')
,但是并不能像我期望的那样生成index.html.相反,看来充其量我可以得到html的字符串输出,这不是我想要的:
but that does not make an index.html as I would expect. Instead, it seems at best I can get a string output of my html, which isn't what I want:
var jade = require('!jade!index.jade') jade() //outputs my html如何获取它以输出index.html文件?如何让webpack-dev-server使用该html文件?
How do I get it to output an index.html file? How do I get the webpack-dev-server to use that html file?
我还应该提到我的玉器文件可能会引用手写笔文件
I should also mention my jade file will likely reference stylus files
推荐答案我使用 jade-html-loader 在webpack.config.js中输入以下内容:
I use jade-html-loader with the following entry in webpack.config.js:
entry: ['./src/app.js', 'file?name=index.html!jade-html!./src/index.jade']您将需要
npm install --save-dev file-loader jade-html-loader jade更多推荐
如何将自己的玉文件用于webpack?
发布评论