如何将自己的玉文件用于webpack?

编程入门 行业动态 更新时间:2024-10-27 22:19:03
本文介绍了如何将自己的玉文件用于webpack?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是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?

本文发布于:2023-11-11 13:41:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578605.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自己的   如何将   文件   webpack

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!