html-webpack-cheeky-insert-plugin
Adds ability to insert HTML into files generated with the HTML Webpack Plugin
Install
$ npm install --save-dev html-webpack-cheeky-insert-plugin
$ yarn add --dev html-webpack-cheeky-insert-plugin
Usage
webkit.config.js
const HtmlWebpackPlugin = ;const HtmlWebpackInsertPlugin = ; moduleexports = entry: "index.js" output: path: __dirname + "/dist" filename: "bundle.js" plugins: //whether the html should be inserted at the top of the document top: false //tag to insert html into tag: "body" //html to be inserted, or an array of html strings html: ""
Example
webkit.config.js
... plugins: title: "Test" html: "<p>Hello World</p>" ...
index.html
Test Hello World
Example with array
webkit.config.js
... plugins: tag: "head" html: "<meta name='description' content='Cheeky cheeky!'>" "<meta name='keywords' content='A,B,C'>" "<meta name='author' content='Morgan Barrett'>" "<meta name='viewport' content='width=device-width, initial-scale=1.0'>" ...
index.html
Example with top
webkit.config.js
... plugins: filename: "cheekyServer.php" top: true html: "<?php" "if(rand(0, 5) == 2){" "echo '<h1>Random 404</h1>';" "exit;" "}" "?>" ...
cheekyServer.php