【问题标题】:Webpack jade-html-loaderWebpack 玉-html-loader
【发布时间】:2016-01-20 17:31:08
【问题描述】:

我正在使用 webpack 并且我想与它一起使用jade,目前我正在使用jade-html-laoder,但是当我运行 webpack watch 命令时,HTML 文件的结果带有嵌入的所有 javascript 代码。

这是我的 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"
        })
      ]
    };

【问题讨论】:

    标签: javascript pug webpack


    【解决方案1】:

    您是否尝试过使用新版本? 玉现在被称为哈巴狗。

    这对我有用:

    module: {
       loaders: [
           {
            test: /\.jade$/,
            loader: 'pug-html-loader'
           }
       ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-04
      • 1970-01-01
      • 2016-11-16
      • 1970-01-01
      • 2022-07-02
      • 2018-08-11
      • 2019-08-25
      • 1970-01-01
      相关资源
      最近更新 更多