html打开加载alex,GitHub - AlexLosynets/html-webpack-plugin: Simplifies creation of HTML files to serve y...

68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f68746d6c2d7765627061636b2d706c7567696e2e737667

68747470733a2f2f696d672e736869656c64732e696f2f6e6f64652f762f68746d6c2d7765627061636b2d706c7567696e2e737667

68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f64772f68746d6c2d7765627061636b2d706c7567696e2e737667

68747470733a2f2f64617669642d646d2e6f72672f6a616e74696d6f6e2f68746d6c2d7765627061636b2d706c7567696e2e737667

687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6a616e74696d6f6e2f68746d6c2d7765627061636b2d706c7567696e2e737667

68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f68746d6c2d7765627061636b2d706c7567696e2f6261636b6572732f62616467652e737667

68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f68746d6c2d7765627061636b2d706c7567696e2f73706f6e736f72732f62616467652e737667

68747470733a2f2f776f726c64766563746f726c6f676f2e636f6d2f6c6f676f732f68746d6c352e737667

68747470733a2f2f7765627061636b2e6a732e6f72672f6173736574732f69636f6e2d7371756172652d6269672e737667

687474703a2f2f6d69636861656c2d63696e696177736b792e6769746875622e696f2f706f73746373732d6c6f61642d706c7567696e732f6c6f676f2e737667

HTML Webpack Plugin

Plugin that simplifies creation of HTML files to serve your bundles

Install Alpha

npm i --save-dev html-webpack-plugin@next

yarn add --dev html-webpack-plugin@next

Install Stable

npm i --save-dev html-webpack-plugin

yarn add --dev html-webpack-plugin

This is a webpack plugin that simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply

your own template using lodash templates or use your own loader.

Plugins

The html-webpack-plugin provides hooks to extend it to your needs. There are already some really powerful plugins which can be integrated with zero configuration

appcache-webpack-plugin for iOS and Android offline usage

favicons-webpack-plugin which generates favicons and icons for iOS, Android and desktop browsers

html-webpack-harddisk-plugin can be used to always write to disk the html file, useful when webpack-dev-server / HMR are being used

html-webpack-inline-source-plugin to inline your assets in the resulting HTML file

html-webpack-inline-svg-plugin to inline SVGs in the resulting HTML file.

html-webpack-exclude-assets-plugin for excluding assets using regular expressions

html-webpack-include-assets-plugin for including lists of js or css file paths (such as those copied by the copy-webpack-plugin).

script-ext-html-webpack-plugin to add async, defer or module attributes to your

style-ext-html-webpack-plugin to convert your s to external stylesheets into

resource-hints-webpack-plugin to add resource hints for faster initial page loads using and

preload-webpack-plugin for automatically wiring up asynchronous (and other types) of JavaScript chunks using helping with lazy-loading

link-media-html-webpack-plugin allows for injected stylesheet tags to have their media attribute set automatically; useful for providing specific desktop/mobile/print etc. stylesheets that the browser will conditionally download

inline-chunk-manifest-html-webpack-plugin for inlining webpack's chunk manifest. Default extracts manifest and inlines in

html-webpack-inline-style-plugin for inlining styles to HTML elements using juice. Useful for email generation automatisation.

html-webpack-exclude-empty-assets-plugin removes empty assets from being added to the html. This fixes some problems with extract-text-plugin with webpack 4.

webpack-concat-plugin for concat and uglify files that needn't to be webpack bundles(for legacy files) and inject to html-webpack-plugin.

Usage

The plugin will generate an HTML5 file for you that includes all your webpack

bundles in the body using script tags. Just add the plugin to your webpack

config as follows:

webpack.config.js

const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {

entry: 'index.js',

output: {

path: __dirname + '/dist',

filename: 'index_bundle.js'

},

plugins: [

new HtmlWebpackPlugin()

]

}

This will generate a file dist/index.html containing the following

Webpack App

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值