how to have use own jade file for webpack?

☆樱花仙子☆ 提交于 2020-01-01 05:52:12

问题


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.

in my app.js I have:

require('!jade!index.jade')

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

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


回答1:


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']

You will need

npm install --save-dev file-loader jade-html-loader jade


来源:https://stackoverflow.com/questions/32302344/how-to-have-use-own-jade-file-for-webpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!