[英]Webpack jade-html-loader
Im using webpack and I want to use jade with it, currently Im using the jade-html-laoder but when I run the webpack watch command the result of the HTML file comes with all the javascript code embedded. 我正在使用webpack,并且我想将其与jade一起使用,目前我正在使用jade-html-laoder,但是当我运行webpack watch命令时,HTML文件的结果附带了所有嵌入的javascript代码。
This is my webpack.config.js 这是我的webpack.config.js
var webpack = require('webpack'),
BrowserSyncPlugin = require('browser-sync-webpack-plugin'),
html = require('jade-html-loader'),
path = require('path');
require('es6-promise').polyfill();
module.exports = {
entry: ['./js/scripts.js', 'file?name=index.html!jade-html!./index.jade'],
output: {filename: './js/bundle.js'},
module: {
loaders: [{
test: /\.js?/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.jade$/,
loader: 'jade'
},
{
test: /\.css$/,
loader: "style!css"
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}]
},
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
server: {baseDir: './'},
reload: true,
files: "*.html"
})
]
};
Have you tried using a new version ? 您是否尝试过使用新版本? jade is now called pug.
玉现在被称为哈巴狗。
whis is working for me: 这为我工作:
module: {
loaders: [
{
test: /\.jade$/,
loader: 'pug-html-loader'
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.