Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to have use own jade file for webpack?

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

like image 208
Terence Chow Avatar asked Jan 07 '23 16:01

Terence Chow


1 Answers

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
like image 185
the_karel Avatar answered Jan 18 '23 12:01

the_karel