preloader-html-webpack-plugin

所属分类:构建工具
开发工具:HTML
文件大小:9KB
下载次数:0
上传日期:2022-01-19 04:16:23
上 传 者sh-1993
说明:  Webpack插件,用于插入标准浏览器检查、不支持的浏览器消息和加载指示器。
(Webpack plugin to insert standard browser checks, unsupported browser messages, and loading indicator.)

文件列表:
LICENSE (1067, 2022-01-19)
index.js (2222, 2022-01-19)
lib (0, 2022-01-19)
lib\browserCheckScript.html (7013, 2022-01-19)
lib\browserIndicator.html (2531, 2022-01-19)
lib\loadIndicator.html (911, 2022-01-19)
package-lock.json (614, 2022-01-19)
package.json (904, 2022-01-19)

# preloader-html-webpack-plugin [![Dependency Status](https://david-dm.org/uqlibrary/preloader-html-webpack-plugin.svg)](https://david-dm.org/uqlibrary/preloader-html-webpack-plugin) This is a a hook to [webpack](http://webpack.github.io/) plugin [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) which inserts standard browser checks, unsupported browser messages, and loading indicator. Default code does not have any dependencies, has it's own CSS to style messages, and uses vanilla JavaScript to check browser versions (suitable for any JS framework, library, etc). Default browser check will load `browser-update.org/update.min.js` from . Browser min requirements: `{i:10,f:40,o:30,s:7,c:40,y:13,uc:12}` ## Installation This hook is not registered with npm, to install it, insert into package.json and then run `npm install` ```javascript "preloader-html-webpack-plugin": "github:uqlibrary/preloader-html-webpack-plugin#master" ``` ## Basic Usage The hook will insert HTML/JS required for browser check, noscript message, loader graphic. Just add the plugin to your webpack config as follows: ```javascript var InjectPreloader = require("preloader-html-webpack-plugin"); var webpackConfig = { plugins: [new InjectPreloader()] }; ``` Your HTML entry page has to have placeholders for the hook to insert the code, eg `` Placeholders are configurable and can be customised as required. ```html
``` ## Configuration You can pass a hash of configuration options to `InjectPreloader`. Allowed values are as follows: - `browserIndicatorPlaceholder`: a placeholder where noscript/unsupported browser message to be inserted. default value is `` - `loadIndicatorPlaceholder`: a placeholder where a loader graphic to be inserted. default value is `` - `browserUpdateScriptPlaceholder`: a placeholder where a browser check script to be inserted. default value is `` - `browserIndicatorTemplate`: an HTML template of a noscript/unsupported browser message if default is not suitable. Default value is `./lib/browserIndicator.html` - `loadIndicatorTemplate`: an HTML template of a load graphic if default is not suitable. Default value is `./lib/loadIndicator.html` - `browserCheckScriptTemplate`: a browser check script template if default is not suitable. Default value is `./lib/browserCheckScript.html` _Example: set load indicator template to a custom template located in the project's public/ directory:_ ```javascript var webpackConfig = { plugins: [ ...new InjectPreloader({ loadIndicatorTemplate: resolve( __dirname, "./public/customLoadIndicator.html" ) }) ] }; ``` ## License This project is licensed under [MIT](https://github.com/uqlibrary/preloader-html-webpack-plugin/blob/master/LICENSE).

近期下载者

相关文件


收藏者