├── .bithoundrc ├── .editorconfig ├── .github └── issue_template.md ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── appveyor.yml ├── default_index.ejs ├── docs └── template-option.md ├── examples ├── appcache │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ ├── manifest.appcache │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ ├── manifest.appcache │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ ├── manifest.appcache │ │ │ └── styles.css │ ├── example.js │ ├── logo.png │ ├── main.css │ ├── template.html │ └── webpack.config.js ├── build-examples.js ├── custom-template │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── logo.png │ ├── main.css │ ├── partial.html │ ├── readme.md │ ├── template.html │ └── webpack.config.js ├── default │ ├── dist │ │ ├── webpack-1 │ │ │ ├── bundle.js │ │ │ └── index.html │ │ ├── webpack-2 │ │ │ ├── bundle.js │ │ │ └── index.html │ │ └── webpack-3 │ │ │ ├── bundle.js │ │ │ └── index.html │ ├── example.js │ ├── main.css │ ├── readme.md │ └── webpack.config.js ├── favicon │ ├── dist │ │ ├── webpack-1 │ │ │ ├── bundle.js │ │ │ ├── favicon.html │ │ │ ├── favicon.ico │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── bundle.js │ │ │ ├── favicon.html │ │ │ ├── favicon.ico │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── bundle.js │ │ │ ├── favicon.html │ │ │ ├── favicon.ico │ │ │ └── styles.css │ ├── example.js │ ├── favicon.ico │ ├── main.css │ ├── template.html │ └── webpack.config.js ├── html-loader │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── about.html │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── about.html │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── about.html │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── favicon.ico │ ├── logo.png │ ├── main.css │ ├── template.html │ └── webpack.config.js ├── inline │ ├── dist │ │ ├── webpack-1 │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── favicon.ico │ ├── main.css │ ├── readme.md │ ├── template.jade │ └── webpack.config.js ├── jade-loader │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── favicon.ico │ ├── logo.png │ ├── main.css │ ├── readme.md │ ├── template.jade │ ├── time.jade │ └── webpack.config.js ├── javascript-advanced │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── logo.png │ ├── main.css │ ├── partial.html │ ├── readme.md │ ├── template.js │ ├── universial.js │ └── webpack.config.js ├── javascript │ ├── dist │ │ ├── webpack-1 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ ├── webpack-2 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ │ └── webpack-3 │ │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ │ ├── bundle.js │ │ │ ├── index.html │ │ │ └── styles.css │ ├── example.js │ ├── logo.png │ ├── main.css │ ├── partial.html │ ├── readme.md │ ├── template.js │ ├── universial.js │ └── webpack.config.js └── sort-manually │ ├── a.js │ ├── b.js │ ├── c.js │ ├── d.js │ ├── dist │ ├── webpack-1 │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── first-file.html │ │ ├── second-file.html │ │ └── styles.css │ ├── webpack-2 │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── first-file.html │ │ ├── second-file.html │ │ └── styles.css │ └── webpack-3 │ │ ├── 0714810ae3fb211173e2964249507195.png │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── d.js │ │ ├── e.js │ │ ├── first-file.html │ │ ├── second-file.html │ │ └── styles.css │ ├── e.js │ ├── logo.png │ ├── main.css │ ├── template.html │ └── webpack.config.js ├── index.js ├── lib ├── chunksorter.js ├── compiler.js ├── errors.js └── loader.js ├── migration.md ├── package-lock.json ├── package.json ├── spec ├── BasicSpec.js ├── CachingSpec.js ├── ExampleSpec.js ├── fixtures │ ├── async.js │ ├── common.js │ ├── empty_html.html │ ├── favicon.ico │ ├── index.js │ ├── invalid.html │ ├── legacy.html │ ├── main.css │ ├── plain.html │ ├── spaced_plain.html │ ├── template.jade │ ├── templateParam.js │ ├── test.html │ ├── theme.js │ ├── util.js │ └── webpackconfig.html └── support │ └── jasmine.json └── yarn.lock /.bithoundrc: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": [ 3 | "**/examples/**", 4 | "**/node_modules/**", 5 | ], 6 | "test": [ 7 | "**/spec/**" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Prerequisites 4 | 5 | - We realize there is a lot of data requested here. We ask only that you do your best to provide as much information as possible so we can better help you. 6 | - Support questions are better asked in one of the following locations: 7 | - [Stack Overflow](http://stackoverflow.com/questions/tagged/html-webpack-plugin) 8 | - Ensure the issue isn't already reported. 9 | - Should be reproducible with the latest version of `html-webpack-plugin`. 10 | - (Ensure `npm ls html-webpack-plugin` matches ![](https://img.shields.io/npm/v/html-webpack-plugin.svg)) 11 | 12 | *Delete the above section and the instructions in the sections below before submitting* 13 | 14 | 15 | ## Description 16 | 17 | If this is a feature request, explain why it should be added. Specific use-cases are best. 18 | 19 | For bug reports, please provide as much *relevant* info as possible. 20 | 21 | ### Error Message & Stack Trace 22 | 23 | ``` 24 | COPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE 25 | ``` 26 | 27 | ### Config 28 | 29 | Copy the relevant section from `webpack.config.js`: 30 | 31 | ```js 32 | module.exports = { 33 | entry: 'app.js', 34 | output: { 35 | path: 'dist', 36 | filename: 'index_bundle.js' 37 | }, 38 | module: { 39 | rules: [ 40 | ... 41 | ] 42 | } 43 | plugins: [ 44 | new HtmlWebpackPlugin(), 45 | ... 46 | ] 47 | } 48 | ``` 49 | 50 | Copy your template file: 51 | 52 | ```html 53 | 54 | 55 | 56 | My App 57 | 58 | 59 | 60 | 61 | ``` 62 | 63 | 64 | ## Relevant Links 65 | 66 | - If your project is public, link to the repo so we can investigate directly. 67 | - **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support. 68 | 69 | 70 | ## Environment 71 | 72 | Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly: 73 | 74 | ``` 75 | node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())" 76 | npm --version 77 | npm ls webpack 78 | npm ls html-webpack-plugin 79 | ``` 80 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /dist/ 3 | npm-debug.log 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4" 4 | - "5" 5 | - "6" 6 | env: 7 | - WEBPACK_VERSION=1 EXTRACT_PLUGIN_VERSION=1 8 | - WEBPACK_VERSION=2 EXTRACT_PLUGIN_VERSION=2 9 | - WEBPACK_VERSION=3 EXTRACT_PLUGIN_VERSION=3.0.0-beta.3 10 | before_install: 11 | - stty columns 120 12 | install: 13 | - npm install --ignore-scripts 14 | - npm rm webpack 15 | - npm rm extract-text-webpack-plugin 16 | - npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_PLUGIN_VERSION --ignore-scripts || true 17 | script: 18 | - npm test 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Charles Blaxland 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # appveyor file 2 | # http://www.appveyor.com/docs/appveyor-yml 3 | 4 | environment: 5 | matrix: 6 | - nodejs_version: 0.10 7 | - nodejs_version: 0.12 8 | - nodejs_version: 4 9 | 10 | version: "{build}" 11 | build: off 12 | deploy: off 13 | matrix: 14 | fast_finish: true 15 | 16 | install: 17 | - ps: Install-Product node $env:nodejs_version 18 | - npm install 19 | 20 | test_script: 21 | - node --version 22 | - npm --version 23 | - npm test 24 | -------------------------------------------------------------------------------- /default_index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= htmlWebpackPlugin.options.title %> 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/template-option.md: -------------------------------------------------------------------------------- 1 | # The template option 2 | 3 | ## History 4 | 5 | The version 2.x which was introduced last year (Sep, 2015) changed the way the template is processed. 6 | Instead of forcing all users to use the [blueimp](https://github.com/blueimp/JavaScript-Templates) template engine it allowed to use any webpack loader: 7 | 8 | * [jade/pug](https://github.com/pugjs/pug-loader) 9 | * [ejs](https://github.com/okonet/ejs-loader) 10 | * [underscore](https://github.com/emaphp/underscore-template-loader) 11 | * [handlebars](https://github.com/pcardune/handlebars-loader) 12 | * [html-loader](https://github.com/webpack/html-loader) 13 | * ... 14 | 15 | Under the hood it is using a webpack child compilation which inherits all loaders from 16 | your main configuration. 17 | 18 | There are three ways to set the loader: 19 | 20 | ## 1) Don't set any loader 21 | 22 | By default (if you don't specify any loader in any way) a [fallback ejs loader](https://github.com/ampedandwired/html-webpack-plugin/blob/master/lib/loader.js) kicks in. 23 | 24 | ```js 25 | { 26 | plugins: [ 27 | new HtmlWebpackPlugin({ 28 | template: 'src/index.ejs' 29 | }) 30 | ] 31 | } 32 | ``` 33 | It is a good idea to use `.ejs` instead of `.html` so you do not unexpectedly trigger another loader. 34 | 35 | ## 2) Setting a loader directly for the template 36 | 37 | ```js 38 | new HtmlWebpackPlugin({ 39 | // For details on `!!` see https://webpack.github.io/docs/loaders.html#loader-order 40 | template: '!!handlebars!src/index.hbs' 41 | }) 42 | ``` 43 | 44 | ## 3) Setting a loader using the `module.loaders` syntax 45 | 46 | ```js 47 | { 48 | module: { 49 | loaders: [ 50 | { 51 | test: /\.hbs$/, 52 | loader: 'handlebars-loader' 53 | }, 54 | ] 55 | }, 56 | plugins: [ 57 | new HtmlWebpackPlugin({ 58 | template: 'src/index.hbs' 59 | }) 60 | ] 61 | } 62 | ``` 63 | 64 | However this also means that in the following example webpack will use the [html loader for your template](https://webpack.js.org/loaders/html-loader/). 65 | This will **cause html minification** and it will also **disable the ejs fallback** loader. 66 | 67 | ```js 68 | { 69 | module: { 70 | loaders: [ 71 | { 72 | test: /\.html$/, 73 | loader: 'html-loader' 74 | }], 75 | }, 76 | plugins: [ 77 | new HtmlWebpackPlugin({ 78 | template: 'src/index.html' 79 | }) 80 | ] 81 | } 82 | ``` 83 | -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/appcache/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1); 48 | var h1 = document.createElement('h1'); 49 | h1.innerHTML = 'Hello world!'; 50 | document.body.appendChild(h1); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | Example template -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-1/manifest.appcache: -------------------------------------------------------------------------------- 1 | CACHE MANIFEST 2 | # f688cbdde5a6e721015e 3 | 4 | 0714810ae3fb211173e2964249507195.png 5 | bundle.js 6 | styles.css 7 | 8 | NETWORK: 9 | * 10 | -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/appcache/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | __webpack_require__(0); 80 | var h1 = document.createElement('h1'); 81 | h1.innerHTML = 'Hello world!'; 82 | document.body.appendChild(h1); 83 | 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | Example template -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-2/manifest.appcache: -------------------------------------------------------------------------------- 1 | CACHE MANIFEST 2 | # 737de2033617f9f6144d 3 | 4 | 0714810ae3fb211173e2964249507195.png 5 | bundle.js 6 | styles.css 7 | 8 | NETWORK: 9 | * 10 | -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/appcache/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | __webpack_require__(1); 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'Hello world!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | // removed by extract-text-webpack-plugin 81 | 82 | /***/ }) 83 | /******/ ]); -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | Example template -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-3/manifest.appcache: -------------------------------------------------------------------------------- 1 | CACHE MANIFEST 2 | # eda37a6c6de5fd0ecfbe 3 | 4 | 0714810ae3fb211173e2964249507195.png 5 | bundle.js 6 | styles.css 7 | 8 | NETWORK: 9 | * 10 | -------------------------------------------------------------------------------- /examples/appcache/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/appcache/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'Hello world!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/appcache/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/appcache/logo.png -------------------------------------------------------------------------------- /examples/appcache/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/appcache/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/appcache/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var AppCachePlugin = require('appcache-webpack-plugin'); 3 | var HtmlWebpackPlugin = require('../..'); 4 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 5 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 6 | 7 | module.exports = { 8 | context: __dirname, 9 | entry: './example.js', 10 | output: { 11 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 12 | publicPath: '', 13 | filename: 'bundle.js' 14 | }, 15 | module: { 16 | loaders: [ 17 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 18 | { test: /\.png$/, loader: 'file-loader' }, 19 | { test: /\.html$/, loader: 'html-loader?-removeOptionalTags' } 20 | ] 21 | }, 22 | plugins: [ 23 | new AppCachePlugin(), 24 | new HtmlWebpackPlugin({ 25 | filename: 'index.html', 26 | template: 'template.html', 27 | minify: { 28 | removeComments: true, 29 | collapseWhitespace: true 30 | } 31 | }), 32 | new ExtractTextPlugin('styles.css') 33 | ] 34 | }; 35 | -------------------------------------------------------------------------------- /examples/build-examples.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file is just a helper to compile all examples. 3 | * 4 | * You could do the same by going into each example and execute 5 | * `webpack` 6 | */ 7 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 8 | 9 | var fs = require('fs'); 10 | var path = require('path'); 11 | var rimraf = require('rimraf'); 12 | var webpack = require('webpack'); 13 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 14 | 15 | if (Number(webpackMajorVersion) > 1) { 16 | var extractOriginal = ExtractTextPlugin.extract; 17 | ExtractTextPlugin.extract = function (fallback, use) { 18 | return extractOriginal({ 19 | fallback: fallback, 20 | use: use 21 | }); 22 | }; 23 | } 24 | 25 | var examples = fs.readdirSync(__dirname).filter(function (file) { 26 | return fs.statSync(path.join(__dirname, file)).isDirectory(); 27 | }); 28 | 29 | examples.forEach(function (exampleName) { 30 | var examplePath = path.join(__dirname, exampleName); 31 | var configFile = path.join(examplePath, 'webpack.config.js'); 32 | 33 | rimraf.sync(path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion)); 34 | webpack(require(configFile), function (err, stats) { 35 | if (err) { 36 | console.error(err.stack || err); 37 | if (err.details) { 38 | console.error(err.details); 39 | } 40 | return; 41 | } 42 | 43 | const info = stats.toJson(); 44 | 45 | if (stats.hasErrors()) { 46 | console.error(info.errors); 47 | } 48 | 49 | if (stats.hasWarnings()) { 50 | console.warn(info.warnings); 51 | } 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/custom-template/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1); 48 | var h1 = document.createElement('h1'); 49 | h1.innerHTML = 'Hello world!'; 50 | document.body.appendChild(h1); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 |

Partial

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/custom-template/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | __webpack_require__(0); 80 | var h1 = document.createElement('h1'); 81 | h1.innerHTML = 'Hello world!'; 82 | document.body.appendChild(h1); 83 | 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 |

Partial

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/custom-template/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | __webpack_require__(1); 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'Hello world!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | // removed by extract-text-webpack-plugin 81 | 82 | /***/ }) 83 | /******/ ]); -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 |

Partial

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/custom-template/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/custom-template/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'Hello world!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/custom-template/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/custom-template/logo.png -------------------------------------------------------------------------------- /examples/custom-template/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/custom-template/partial.html: -------------------------------------------------------------------------------- 1 |

Partial

2 | -------------------------------------------------------------------------------- /examples/custom-template/readme.md: -------------------------------------------------------------------------------- 1 | # custom template 2 | 3 | This example uses a custom underscore template which inlines an partial using the html-loader: 4 | `<%= require('html!./partial.html') %>` -------------------------------------------------------------------------------- /examples/custom-template/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= htmlWebpackPlugin.options.title %> 6 | 7 | 8 | 9 | <%= require('html-loader!./partial.html') %> 10 | 11 | 12 | -------------------------------------------------------------------------------- /examples/custom-template/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | 6 | module.exports = { 7 | context: __dirname, 8 | entry: './example.js', 9 | output: { 10 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 11 | publicPath: '', 12 | filename: 'bundle.js' 13 | }, 14 | module: { 15 | loaders: [ 16 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 17 | { test: /\.png$/, loader: 'file-loader' } 18 | ] 19 | }, 20 | plugins: [ 21 | new HtmlWebpackPlugin({ 22 | template: 'template.html' 23 | }), 24 | new ExtractTextPlugin('styles.css') 25 | ] 26 | }; 27 | -------------------------------------------------------------------------------- /examples/default/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/default/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/default/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/default/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'Hello world!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/default/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/default/readme.md: -------------------------------------------------------------------------------- 1 | # zero-config example 2 | 3 | in this example only the default configuration is used -------------------------------------------------------------------------------- /examples/default/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 4 | module.exports = { 5 | context: __dirname, 6 | entry: './example.js', 7 | output: { 8 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 9 | publicPath: '', 10 | filename: 'bundle.js' 11 | }, 12 | module: { 13 | loaders: [ 14 | { test: /\.css$/, loader: 'style-loader!css-loader' }, 15 | { test: /\.png$/, loader: 'file-loader' } 16 | ] 17 | }, 18 | plugins: [ 19 | new HtmlWebpackPlugin() 20 | ] 21 | }; 22 | -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1); 48 | var h1 = document.createElement('h1'); 49 | h1.innerHTML = 'Hello world!'; 50 | document.body.appendChild(h1); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-1/favicon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HtmlWebpackPlugin example 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-1/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/favicon/dist/webpack-1/favicon.ico -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | __webpack_require__(0); 80 | var h1 = document.createElement('h1'); 81 | h1.innerHTML = 'Hello world!'; 82 | document.body.appendChild(h1); 83 | 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-2/favicon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HtmlWebpackPlugin example 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-2/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/favicon/dist/webpack-2/favicon.ico -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | __webpack_require__(1); 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'Hello world!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | // removed by extract-text-webpack-plugin 81 | 82 | /***/ }) 83 | /******/ ]); -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-3/favicon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HtmlWebpackPlugin example 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-3/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/favicon/dist/webpack-3/favicon.ico -------------------------------------------------------------------------------- /examples/favicon/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/favicon/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'Hello world!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/favicon/favicon.ico -------------------------------------------------------------------------------- /examples/favicon/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/favicon/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/favicon/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: './example.js', 8 | output: { 9 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 10 | publicPath: '', 11 | filename: 'bundle.js' 12 | }, 13 | module: { 14 | loaders: [ 15 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 16 | { test: /\.png$/, loader: 'file-loader' } 17 | ] 18 | }, 19 | plugins: [ 20 | new HtmlWebpackPlugin({ 21 | title: 'HtmlWebpackPlugin example', 22 | favicon: 'favicon.ico', 23 | filename: 'favicon.html' 24 | }), 25 | new ExtractTextPlugin('styles.css') 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1); 48 | var h1 = document.createElement('h1'); 49 | h1.innerHTML = 'Hello world!'; 50 | document.body.appendChild(h1); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-1/favicon.ico -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | __webpack_require__(0); 80 | var h1 = document.createElement('h1'); 81 | h1.innerHTML = 'Hello world!'; 82 | document.body.appendChild(h1); 83 | 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-2/favicon.ico -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | __webpack_require__(1); 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'Hello world!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | // removed by extract-text-webpack-plugin 81 | 82 | /***/ }) 83 | /******/ ]); -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/dist/webpack-3/favicon.ico -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/html-loader/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'Hello world!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/html-loader/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/favicon.ico -------------------------------------------------------------------------------- /examples/html-loader/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/html-loader/logo.png -------------------------------------------------------------------------------- /examples/html-loader/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/html-loader/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/html-loader/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: './example.js', 8 | output: { 9 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 10 | publicPath: '', 11 | filename: 'bundle.js' 12 | }, 13 | module: { 14 | loaders: [ 15 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 16 | { test: /\.png$/, loader: 'file-loader' }, 17 | { test: /\.html$/, loader: 'html-loader' } 18 | ] 19 | }, 20 | plugins: [ 21 | new HtmlWebpackPlugin({ 22 | filename: 'index.html', 23 | favicon: 'favicon.ico', 24 | template: 'template.html' 25 | }), 26 | new HtmlWebpackPlugin({ 27 | filename: 'about.html', 28 | favicon: 'favicon.ico', 29 | template: 'template.html' 30 | }), 31 | new ExtractTextPlugin('styles.css') 32 | ] 33 | }; 34 | -------------------------------------------------------------------------------- /examples/inline/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | 'use strict'; 48 | __webpack_require__(1); 49 | 50 | console.log('Hello World'); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/inline/dist/webpack-1/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/inline/dist/webpack-1/favicon.ico -------------------------------------------------------------------------------- /examples/inline/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | Jade demo -------------------------------------------------------------------------------- /examples/inline/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/inline/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | "use strict"; 80 | 81 | __webpack_require__(0); 82 | 83 | console.log('Hello World'); 84 | 85 | 86 | /***/ }) 87 | /******/ ]); -------------------------------------------------------------------------------- /examples/inline/dist/webpack-2/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/inline/dist/webpack-2/favicon.ico -------------------------------------------------------------------------------- /examples/inline/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | Jade demo -------------------------------------------------------------------------------- /examples/inline/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/inline/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | "use strict"; 71 | 72 | __webpack_require__(1); 73 | 74 | console.log('Hello World'); 75 | 76 | 77 | /***/ }), 78 | /* 1 */ 79 | /***/ (function(module, exports) { 80 | 81 | // removed by extract-text-webpack-plugin 82 | 83 | /***/ }) 84 | /******/ ]); -------------------------------------------------------------------------------- /examples/inline/dist/webpack-3/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/inline/dist/webpack-3/favicon.ico -------------------------------------------------------------------------------- /examples/inline/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | Jade demo -------------------------------------------------------------------------------- /examples/inline/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/inline/example.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./main.css'); 3 | 4 | console.log('Hello World'); 5 | -------------------------------------------------------------------------------- /examples/inline/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/inline/favicon.ico -------------------------------------------------------------------------------- /examples/inline/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/inline/readme.md: -------------------------------------------------------------------------------- 1 | # isomorphic jade example 2 | 3 | This example shows how to use a different template engine (in this case jade) 4 | to load the `time.jade` template on the backend and frontend. 5 | -------------------------------------------------------------------------------- /examples/inline/template.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta(http-equiv="Content-type" content="text/html; charset=utf-8") 5 | title #{htmlWebpackPlugin.options.title} 6 | body 7 | each cssFile in htmlWebpackPlugin.files.css 8 | style !{compilation.assets[cssFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()} 9 | each jsFile in htmlWebpackPlugin.files.js 10 | script(type="text/javascript") !{compilation.assets[jsFile.substr(htmlWebpackPlugin.files.publicPath.length)].source()} 11 | -------------------------------------------------------------------------------- /examples/inline/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | 6 | module.exports = { 7 | context: __dirname, 8 | entry: './example.js', 9 | output: { 10 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 11 | publicPath: '', 12 | filename: 'bundle.js' 13 | }, 14 | module: { 15 | loaders: [ 16 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 17 | { test: /\.jade$/, loader: 'jade-loader' } 18 | ] 19 | }, 20 | plugins: [ 21 | new HtmlWebpackPlugin({ 22 | inject: false, 23 | cache: false, 24 | template: 'template.jade', 25 | filename: 'index.html', 26 | favicon: 'favicon.ico', 27 | title: 'Jade demo' 28 | }), 29 | new ExtractTextPlugin('styles.css') 30 | ] 31 | }; 32 | -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-1/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-1/favicon.ico -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | Jade demo
Current time

1998-12-31T23:00:00.000Z

-------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-2/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-2/favicon.ico -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | Jade demo
Current time

1998-12-31T23:00:00.000Z

-------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-3/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/dist/webpack-3/favicon.ico -------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | Jade demo
Current time

1999-01-01T00:00:00.000Z

-------------------------------------------------------------------------------- /examples/jade-loader/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/jade-loader/example.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | require('./main.css'); 3 | // Use the same template for the frontend code 4 | var template = require('./time.jade'); 5 | 6 | setInterval(function () { 7 | var div = document.getElementById('main'); 8 | div.innerHTML = template({ time: new Date() }); 9 | div.style.color = 'navy'; 10 | }, 1000); 11 | -------------------------------------------------------------------------------- /examples/jade-loader/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/favicon.ico -------------------------------------------------------------------------------- /examples/jade-loader/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/jade-loader/logo.png -------------------------------------------------------------------------------- /examples/jade-loader/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/jade-loader/readme.md: -------------------------------------------------------------------------------- 1 | # isomorphic jade example 2 | 3 | This example shows how to use a different template engine (in this case jade) 4 | to load the `time.jade` template on the backend and frontend. 5 | -------------------------------------------------------------------------------- /examples/jade-loader/template.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= htmlWebpackPlugin.options.title 5 | body 6 | #main 7 | - locals.time = new Date('01 01, 1999'); 8 | include ./time.jade -------------------------------------------------------------------------------- /examples/jade-loader/time.jade: -------------------------------------------------------------------------------- 1 | // this partial is used for frontend and backend 2 | .time 3 | b Current time 4 | p #{time.toISOString()} 5 | 6 | img(src="#{require('./logo.png')}") -------------------------------------------------------------------------------- /examples/jade-loader/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: './example.js', 8 | output: { 9 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 10 | publicPath: '', 11 | filename: 'bundle.js' 12 | }, 13 | module: { 14 | loaders: [ 15 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 16 | { test: /\.png$/, loader: 'file-loader' }, 17 | { test: /\.jade$/, loader: 'jade-loader' } 18 | ] 19 | }, 20 | plugins: [ 21 | new HtmlWebpackPlugin({ 22 | filename: 'index.html', 23 | favicon: 'favicon.ico', 24 | template: 'template.jade', 25 | title: 'Jade demo' 26 | }), 27 | new ExtractTextPlugin('styles.css') 28 | ] 29 | }; 30 | -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript-advanced/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(5);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n//# sourceURL=webpack:///./example.js?"); 48 | 49 | /***/ }), 50 | /* 1 */ 51 | /***/ (function(module, exports) { 52 | 53 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n//# sourceURL=webpack:///./main.css?"); 54 | 55 | /***/ }), 56 | /* 2 */, 57 | /* 3 */, 58 | /* 4 */, 59 | /* 5 */ 60 | /***/ (function(module, exports) { 61 | 62 | eval("// This file is used for frontend and backend\n'use strict';\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 5\n// module chunks = 0\n//# sourceURL=webpack:///./universial.js?"); 63 | 64 | /***/ }) 65 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | Webpack AppHello World from backend -

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript-advanced/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 2); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports, __webpack_require__) { 72 | 73 | "use strict"; 74 | eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); 81 | 82 | /***/ }), 83 | /* 2 */ 84 | /***/ (function(module, exports, __webpack_require__) { 85 | 86 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(0);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); 87 | 88 | /***/ }) 89 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | Webpack AppHello World from backend -

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript-advanced/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); 71 | 72 | /***/ }), 73 | /* 1 */ 74 | /***/ (function(module, exports) { 75 | 76 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); 77 | 78 | /***/ }), 79 | /* 2 */ 80 | /***/ (function(module, exports, __webpack_require__) { 81 | 82 | "use strict"; 83 | eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | Webpack AppHello World from backend -

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript-advanced/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript-advanced/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | 3 | var universal = require('./universial.js'); 4 | var h1 = document.createElement('h1'); 5 | h1.innerHTML = universal(); 6 | 7 | document.body.appendChild(h1); 8 | -------------------------------------------------------------------------------- /examples/javascript-advanced/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript-advanced/logo.png -------------------------------------------------------------------------------- /examples/javascript-advanced/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript-advanced/partial.html: -------------------------------------------------------------------------------- 1 |

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript-advanced/readme.md: -------------------------------------------------------------------------------- 1 | # isomorphic javascript-advanced example 2 | 3 | This example is similar to the javascript example however it allows takes 4 | parameters from the config and works asynchronously -------------------------------------------------------------------------------- /examples/javascript-advanced/template.js: -------------------------------------------------------------------------------- 1 | // Webpack require: 2 | var partial = require('./partial.html'); 3 | var universal = require('./universial.js'); 4 | 5 | // Export a function / promise / or a string: 6 | // This function has to return a string or promised string: 7 | module.exports = function (templateParams) { 8 | var html = '' + 9 | '' + templateParams.htmlWebpackPlugin.options.title + '' + 10 | '' + universal() + ' - ' + partial + ''; 11 | 12 | return html; 13 | }; 14 | -------------------------------------------------------------------------------- /examples/javascript-advanced/universial.js: -------------------------------------------------------------------------------- 1 | // This file is used for frontend and backend 2 | 'use strict'; 3 | 4 | // If compiled by the html-webpack-plugin 5 | // HTML_WEBPACK_PLUGIN is set to true: 6 | var backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined'; 7 | 8 | module.exports = function () { 9 | return 'Hello World from ' + (backend ? 'backend' : 'frontend'); 10 | }; 11 | -------------------------------------------------------------------------------- /examples/javascript-advanced/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: './example.js', 8 | output: { 9 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 10 | publicPath: '', 11 | filename: 'bundle.js' 12 | }, 13 | module: { 14 | loaders: [ 15 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 16 | { test: /\.png$/, loader: 'file-loader' }, 17 | { test: /\.html$/, loader: 'html-loader' } 18 | ] 19 | }, 20 | devtool: 'eval', 21 | plugins: [ 22 | new HtmlWebpackPlugin({ 23 | template: 'template.js' 24 | }), 25 | new ExtractTextPlugin('styles.css') 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-1/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(5);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n//# sourceURL=webpack:///./example.js?"); 48 | 49 | /***/ }), 50 | /* 1 */ 51 | /***/ (function(module, exports) { 52 | 53 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n//# sourceURL=webpack:///./main.css?"); 54 | 55 | /***/ }), 56 | /* 2 */, 57 | /* 3 */, 58 | /* 4 */, 59 | /* 5 */ 60 | /***/ (function(module, exports) { 61 | 62 | eval("// This file is used for frontend and backend\n'use strict';\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 5\n// module chunks = 0\n//# sourceURL=webpack:///./universial.js?"); 63 | 64 | /***/ }) 65 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-1/index.html: -------------------------------------------------------------------------------- 1 | Hello World from backend2017-04-17T17:13:11.491Z

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-2/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 2); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports, __webpack_require__) { 72 | 73 | "use strict"; 74 | eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); 75 | 76 | /***/ }), 77 | /* 1 */ 78 | /***/ (function(module, exports) { 79 | 80 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); 81 | 82 | /***/ }), 83 | /* 2 */ 84 | /***/ (function(module, exports, __webpack_require__) { 85 | 86 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(0);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); 87 | 88 | /***/ }) 89 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-2/index.html: -------------------------------------------------------------------------------- 1 | Hello World from backend2017-04-17T17:12:14.752Z

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-3/bundle.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports, __webpack_require__) { 69 | 70 | eval("__webpack_require__(1);\n\nvar universal = __webpack_require__(2);\nvar h1 = document.createElement('h1');\nh1.innerHTML = universal();\n\ndocument.body.appendChild(h1);\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./example.js\n// module id = 0\n// module chunks = 0\n\n//# sourceURL=webpack:///./example.js?"); 71 | 72 | /***/ }), 73 | /* 1 */ 74 | /***/ (function(module, exports) { 75 | 76 | eval("// removed by extract-text-webpack-plugin\n\n//////////////////\n// WEBPACK FOOTER\n// ./main.css\n// module id = 1\n// module chunks = 0\n\n//# sourceURL=webpack:///./main.css?"); 77 | 78 | /***/ }), 79 | /* 2 */ 80 | /***/ (function(module, exports, __webpack_require__) { 81 | 82 | "use strict"; 83 | eval("// This file is used for frontend and backend\n\n\n// If compiled by the html-webpack-plugin\n// HTML_WEBPACK_PLUGIN is set to true:\nvar backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined';\n\nmodule.exports = function () {\n return 'Hello World from ' + (backend ? 'backend' : 'frontend');\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./universial.js\n// module id = 2\n// module chunks = 0\n\n//# sourceURL=webpack:///./universial.js?"); 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-3/index.html: -------------------------------------------------------------------------------- 1 | Hello World from backend2017-06-24T21:03:19.943Z

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript/example.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | 3 | var universal = require('./universial.js'); 4 | var h1 = document.createElement('h1'); 5 | h1.innerHTML = universal(); 6 | 7 | document.body.appendChild(h1); 8 | -------------------------------------------------------------------------------- /examples/javascript/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/javascript/logo.png -------------------------------------------------------------------------------- /examples/javascript/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/javascript/partial.html: -------------------------------------------------------------------------------- 1 |

Partial

2 | -------------------------------------------------------------------------------- /examples/javascript/readme.md: -------------------------------------------------------------------------------- 1 | # isomorphic javascript example 2 | 3 | This example shows how to generate a template on the fly using javascript. 4 | 5 | The best way to debug the compilation result is `devTool:eval` -------------------------------------------------------------------------------- /examples/javascript/template.js: -------------------------------------------------------------------------------- 1 | // Webpack require: 2 | var partial = require('./partial.html'); 3 | var universal = require('./universial.js'); 4 | 5 | // Export a function / promise / or a string: 6 | module.exports = universal() + new Date().toISOString() + partial; 7 | -------------------------------------------------------------------------------- /examples/javascript/universial.js: -------------------------------------------------------------------------------- 1 | // This file is used for frontend and backend 2 | 'use strict'; 3 | 4 | // If compiled by the html-webpack-plugin 5 | // HTML_WEBPACK_PLUGIN is set to true: 6 | var backend = typeof HTML_WEBPACK_PLUGIN !== 'undefined'; 7 | 8 | module.exports = function () { 9 | return 'Hello World from ' + (backend ? 'backend' : 'frontend'); 10 | }; 11 | -------------------------------------------------------------------------------- /examples/javascript/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: './example.js', 8 | output: { 9 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 10 | publicPath: '', 11 | filename: 'bundle.js' 12 | }, 13 | module: { 14 | loaders: [ 15 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 16 | { test: /\.png$/, loader: 'file-loader' }, 17 | { test: /\.html$/, loader: 'html-loader' } 18 | ] 19 | }, 20 | devtool: 'eval', 21 | plugins: [ 22 | new HtmlWebpackPlugin({ 23 | template: 'template.js' 24 | }), 25 | new ExtractTextPlugin('styles.css') 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /examples/sort-manually/a.js: -------------------------------------------------------------------------------- 1 | require('./main.css'); 2 | var h1 = document.createElement('h1'); 3 | h1.innerHTML = 'a!'; 4 | document.body.appendChild(h1); 5 | -------------------------------------------------------------------------------- /examples/sort-manually/b.js: -------------------------------------------------------------------------------- 1 | var h1 = document.createElement('h1'); 2 | h1.innerHTML = 'b!'; 3 | document.body.appendChild(h1); 4 | -------------------------------------------------------------------------------- /examples/sort-manually/c.js: -------------------------------------------------------------------------------- 1 | var h1 = document.createElement('h1'); 2 | h1.innerHTML = 'c!'; 3 | document.body.appendChild(h1); 4 | -------------------------------------------------------------------------------- /examples/sort-manually/d.js: -------------------------------------------------------------------------------- 1 | var h1 = document.createElement('h1'); 2 | h1.innerHTML = 'd!'; 3 | document.body.appendChild(h1); 4 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/sort-manually/dist/webpack-1/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/a.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1); 48 | var h1 = document.createElement('h1'); 49 | h1.innerHTML = 'a!'; 50 | document.body.appendChild(h1); 51 | 52 | 53 | /***/ }), 54 | /* 1 */ 55 | /***/ (function(module, exports) { 56 | 57 | // removed by extract-text-webpack-plugin 58 | 59 | /***/ }) 60 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/b.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | var h1 = document.createElement('h1'); 48 | h1.innerHTML = 'b!'; 49 | document.body.appendChild(h1); 50 | 51 | 52 | /***/ }) 53 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/c.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | var h1 = document.createElement('h1'); 48 | h1.innerHTML = 'c!'; 49 | document.body.appendChild(h1); 50 | 51 | 52 | /***/ }) 53 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/d.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | var h1 = document.createElement('h1'); 48 | h1.innerHTML = 'd!'; 49 | document.body.appendChild(h1); 50 | 51 | 52 | /***/ }) 53 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/e.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ (function(module, exports) { 46 | 47 | var h1 = document.createElement('h1'); 48 | h1.innerHTML = 'e!'; 49 | document.body.appendChild(h1); 50 | 51 | 52 | /***/ }) 53 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/first-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/second-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/sort-manually/dist/webpack-2/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/a.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 1); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ([ 70 | /* 0 */ 71 | /***/ (function(module, exports) { 72 | 73 | // removed by extract-text-webpack-plugin 74 | 75 | /***/ }), 76 | /* 1 */ 77 | /***/ (function(module, exports, __webpack_require__) { 78 | 79 | __webpack_require__(0); 80 | var h1 = document.createElement('h1'); 81 | h1.innerHTML = 'a!'; 82 | document.body.appendChild(h1); 83 | 84 | 85 | /***/ }) 86 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/b.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 2); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ({ 70 | 71 | /***/ 2: 72 | /***/ (function(module, exports) { 73 | 74 | var h1 = document.createElement('h1'); 75 | h1.innerHTML = 'b!'; 76 | document.body.appendChild(h1); 77 | 78 | 79 | /***/ }) 80 | 81 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/c.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 3); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ({ 70 | 71 | /***/ 3: 72 | /***/ (function(module, exports) { 73 | 74 | var h1 = document.createElement('h1'); 75 | h1.innerHTML = 'c!'; 76 | document.body.appendChild(h1); 77 | 78 | 79 | /***/ }) 80 | 81 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/d.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 4); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ({ 70 | 71 | /***/ 4: 72 | /***/ (function(module, exports) { 73 | 74 | var h1 = document.createElement('h1'); 75 | h1.innerHTML = 'd!'; 76 | document.body.appendChild(h1); 77 | 78 | 79 | /***/ }) 80 | 81 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/e.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // identity function for calling harmony imports with the correct context 37 | /******/ __webpack_require__.i = function(value) { return value; }; 38 | /******/ 39 | /******/ // define getter function for harmony exports 40 | /******/ __webpack_require__.d = function(exports, name, getter) { 41 | /******/ if(!__webpack_require__.o(exports, name)) { 42 | /******/ Object.defineProperty(exports, name, { 43 | /******/ configurable: false, 44 | /******/ enumerable: true, 45 | /******/ get: getter 46 | /******/ }); 47 | /******/ } 48 | /******/ }; 49 | /******/ 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules 51 | /******/ __webpack_require__.n = function(module) { 52 | /******/ var getter = module && module.__esModule ? 53 | /******/ function getDefault() { return module['default']; } : 54 | /******/ function getModuleExports() { return module; }; 55 | /******/ __webpack_require__.d(getter, 'a', getter); 56 | /******/ return getter; 57 | /******/ }; 58 | /******/ 59 | /******/ // Object.prototype.hasOwnProperty.call 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61 | /******/ 62 | /******/ // __webpack_public_path__ 63 | /******/ __webpack_require__.p = ""; 64 | /******/ 65 | /******/ // Load entry module and return exports 66 | /******/ return __webpack_require__(__webpack_require__.s = 5); 67 | /******/ }) 68 | /************************************************************************/ 69 | /******/ ({ 70 | 71 | /***/ 5: 72 | /***/ (function(module, exports) { 73 | 74 | var h1 = document.createElement('h1'); 75 | h1.innerHTML = 'e!'; 76 | document.body.appendChild(h1); 77 | 78 | 79 | /***/ }) 80 | 81 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/first-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/second-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-2/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/0714810ae3fb211173e2964249507195.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/sort-manually/dist/webpack-3/0714810ae3fb211173e2964249507195.png -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/a.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 2); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */, 68 | /* 1 */, 69 | /* 2 */ 70 | /***/ (function(module, exports, __webpack_require__) { 71 | 72 | __webpack_require__(3); 73 | var h1 = document.createElement('h1'); 74 | h1.innerHTML = 'a!'; 75 | document.body.appendChild(h1); 76 | 77 | 78 | /***/ }), 79 | /* 3 */ 80 | /***/ (function(module, exports) { 81 | 82 | // removed by extract-text-webpack-plugin 83 | 84 | /***/ }) 85 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/b.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 0); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */ 68 | /***/ (function(module, exports) { 69 | 70 | var h1 = document.createElement('h1'); 71 | h1.innerHTML = 'b!'; 72 | document.body.appendChild(h1); 73 | 74 | 75 | /***/ }) 76 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/c.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 4); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ({ 67 | 68 | /***/ 4: 69 | /***/ (function(module, exports) { 70 | 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'c!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }) 77 | 78 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/d.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 1); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ([ 67 | /* 0 */, 68 | /* 1 */ 69 | /***/ (function(module, exports) { 70 | 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'd!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }) 77 | /******/ ]); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/e.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { 40 | /******/ configurable: false, 41 | /******/ enumerable: true, 42 | /******/ get: getter 43 | /******/ }); 44 | /******/ } 45 | /******/ }; 46 | /******/ 47 | /******/ // getDefaultExport function for compatibility with non-harmony modules 48 | /******/ __webpack_require__.n = function(module) { 49 | /******/ var getter = module && module.__esModule ? 50 | /******/ function getDefault() { return module['default']; } : 51 | /******/ function getModuleExports() { return module; }; 52 | /******/ __webpack_require__.d(getter, 'a', getter); 53 | /******/ return getter; 54 | /******/ }; 55 | /******/ 56 | /******/ // Object.prototype.hasOwnProperty.call 57 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58 | /******/ 59 | /******/ // __webpack_public_path__ 60 | /******/ __webpack_require__.p = ""; 61 | /******/ 62 | /******/ // Load entry module and return exports 63 | /******/ return __webpack_require__(__webpack_require__.s = 5); 64 | /******/ }) 65 | /************************************************************************/ 66 | /******/ ({ 67 | 68 | /***/ 5: 69 | /***/ (function(module, exports) { 70 | 71 | var h1 = document.createElement('h1'); 72 | h1.innerHTML = 'e!'; 73 | document.body.appendChild(h1); 74 | 75 | 76 | /***/ }) 77 | 78 | /******/ }); -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/first-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/second-file.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/dist/webpack-3/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/sort-manually/e.js: -------------------------------------------------------------------------------- 1 | var h1 = document.createElement('h1'); 2 | h1.innerHTML = 'e!'; 3 | document.body.appendChild(h1); 4 | -------------------------------------------------------------------------------- /examples/sort-manually/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/examples/sort-manually/logo.png -------------------------------------------------------------------------------- /examples/sort-manually/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /examples/sort-manually/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example template 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/sort-manually/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var HtmlWebpackPlugin = require('../..'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 5 | module.exports = { 6 | context: __dirname, 7 | entry: { 8 | b: './b.js', 9 | d: './d.js', 10 | a: './a.js', 11 | c: './c.js', 12 | e: './e.js' 13 | }, 14 | output: { 15 | path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion), 16 | publicPath: '', 17 | filename: '[name].js' 18 | }, 19 | module: { 20 | loaders: [ 21 | { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, 22 | { test: /\.png$/, loader: 'file-loader' }, 23 | { test: /\.html$/, loader: 'html-loader' } 24 | ] 25 | }, 26 | plugins: [ 27 | new HtmlWebpackPlugin({ 28 | inject: true, 29 | filename: 'first-file.html', 30 | template: 'template.html', 31 | chunksSortMode: 'manual', 32 | chunks: ['a', 'b', 'c'] 33 | }), 34 | new HtmlWebpackPlugin({ 35 | inject: true, 36 | filename: 'second-file.html', 37 | template: 'template.html', 38 | chunksSortMode: 'manual', 39 | chunks: ['a', 'b', 'd'] 40 | }), 41 | new ExtractTextPlugin('styles.css') 42 | ] 43 | }; 44 | -------------------------------------------------------------------------------- /lib/chunksorter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var toposort = require('toposort'); 4 | var _ = require('lodash'); 5 | 6 | /* 7 | Sorts dependencies between chunks by their "parents" attribute. 8 | 9 | This function sorts chunks based on their dependencies with each other. 10 | The parent relation between chunks as generated by Webpack for each chunk 11 | is used to define a directed (and hopefully acyclic) graph, which is then 12 | topologically sorted in order to retrieve the correct order in which 13 | chunks need to be embedded into HTML. A directed edge in this graph is 14 | describing a "is parent of" relationship from a chunk to another (distinct) 15 | chunk. Thus topological sorting orders chunks from bottom-layer chunks to 16 | highest level chunks that use the lower-level chunks. 17 | 18 | @param {Array} chunks an array of chunks as generated by the html-webpack-plugin. 19 | It is assumed that each entry contains at least the properties "id" 20 | (containing the chunk id) and "parents" (array containing the ids of the 21 | parent chunks). 22 | 23 | @return {Array} A topologically sorted version of the input chunks 24 | */ 25 | module.exports.dependency = function (chunks) { 26 | if (!chunks) { 27 | return chunks; 28 | } 29 | 30 | // We build a map (chunk-id -> chunk) for faster access during graph building. 31 | var nodeMap = {}; 32 | 33 | chunks.forEach(function (chunk) { 34 | nodeMap[chunk.id] = chunk; 35 | }); 36 | 37 | // Next, we add an edge for each parent relationship into the graph 38 | var edges = []; 39 | 40 | chunks.forEach(function (chunk) { 41 | if (chunk.parents) { 42 | // Add an edge for each parent (parent -> child) 43 | chunk.parents.forEach(function (parentId) { 44 | // webpack2 chunk.parents are chunks instead of string id(s) 45 | var parentChunk = _.isObject(parentId) ? parentId : nodeMap[parentId]; 46 | // If the parent chunk does not exist (e.g. because of an excluded chunk) 47 | // we ignore that parent 48 | if (parentChunk) { 49 | edges.push([parentChunk, chunk]); 50 | } 51 | }); 52 | } 53 | }); 54 | // We now perform a topological sorting on the input chunks and built edges 55 | return toposort.array(chunks, edges); 56 | }; 57 | 58 | /** 59 | * Sorts the chunks based on the chunk id. 60 | * 61 | * @param {Array} chunks the list of chunks to sort 62 | * @return {Array} The sorted list of chunks 63 | */ 64 | module.exports.id = function (chunks) { 65 | return chunks.sort(function orderEntryLast (a, b) { 66 | if (a.entry !== b.entry) { 67 | return b.entry ? 1 : -1; 68 | } else { 69 | return b.id - a.id; 70 | } 71 | }); 72 | }; 73 | 74 | /** 75 | * Performs identity mapping (no-sort). 76 | * @param {Array} chunks the chunks to sort 77 | * @return {Array} The sorted chunks 78 | */ 79 | module.exports.none = function (chunks) { 80 | return chunks; 81 | }; 82 | 83 | /** 84 | * Sort manually by the chunks 85 | * @param {Array} chunks the chunks to sort 86 | * @return {Array} The sorted chunks 87 | */ 88 | module.exports.manual = function (chunks, specifyChunks) { 89 | var chunksResult = []; 90 | var filterResult = []; 91 | if (Array.isArray(specifyChunks)) { 92 | for (var i = 0; i < specifyChunks.length; i++) { 93 | filterResult = chunks.filter(function (chunk) { 94 | if (chunk.names[0] && chunk.names[0] === specifyChunks[i]) { 95 | return true; 96 | } 97 | return false; 98 | }); 99 | filterResult.length > 0 && chunksResult.push(filterResult[0]); 100 | } 101 | } 102 | return chunksResult; 103 | }; 104 | 105 | /** 106 | * Defines the default sorter. 107 | */ 108 | module.exports.auto = module.exports.id; 109 | 110 | // In webpack 2 the ids have been flipped. 111 | // Therefore the id sort doesn't work the same way as it did for webpack 1 112 | // Luckily the dependency sort is working as expected 113 | if (Number(require('webpack/package.json').version.split('.')[0]) > 1) { 114 | module.exports.auto = module.exports.dependency; 115 | } 116 | -------------------------------------------------------------------------------- /lib/compiler.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This file uses webpack to compile a template with a child compiler. 3 | * 4 | * [TEMPLATE] -> [JAVASCRIPT] 5 | * 6 | */ 7 | 'use strict'; 8 | var Promise = require('bluebird'); 9 | var _ = require('lodash'); 10 | var path = require('path'); 11 | var NodeTemplatePlugin = require('webpack/lib/node/NodeTemplatePlugin'); 12 | var NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin'); 13 | var LoaderTargetPlugin = require('webpack/lib/LoaderTargetPlugin'); 14 | var LibraryTemplatePlugin = require('webpack/lib/LibraryTemplatePlugin'); 15 | var SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin'); 16 | 17 | /** 18 | * Compiles the template into a nodejs factory, adds its to the compilation.assets 19 | * and returns a promise of the result asset object. 20 | * 21 | * @param template relative path to the template file 22 | * @param context path context 23 | * @param outputFilename the file name 24 | * @param compilation The webpack compilation object 25 | * 26 | * Returns an object: 27 | * { 28 | * hash: {String} - Base64 hash of the file 29 | * content: {String} - Javascript executable code of the template 30 | * } 31 | * 32 | */ 33 | module.exports.compileTemplate = function compileTemplate (template, context, outputFilename, compilation) { 34 | // The entry file is just an empty helper as the dynamic template 35 | // require is added in "loader.js" 36 | var outputOptions = { 37 | filename: outputFilename, 38 | publicPath: compilation.outputOptions.publicPath 39 | }; 40 | // Store the result of the parent compilation before we start the child compilation 41 | var assetsBeforeCompilation = _.assign({}, compilation.assets[outputOptions.filename]); 42 | // Create an additional child compiler which takes the template 43 | // and turns it into an Node.JS html factory. 44 | // This allows us to use loaders during the compilation 45 | var compilerName = getCompilerName(context, outputFilename); 46 | var childCompiler = compilation.createChildCompiler(compilerName, outputOptions); 47 | childCompiler.context = context; 48 | childCompiler.apply( 49 | new NodeTemplatePlugin(outputOptions), 50 | new NodeTargetPlugin(), 51 | new LibraryTemplatePlugin('HTML_WEBPACK_PLUGIN_RESULT', 'var'), 52 | new SingleEntryPlugin(this.context, template), 53 | new LoaderTargetPlugin('node') 54 | ); 55 | 56 | // Fix for "Uncaught TypeError: __webpack_require__(...) is not a function" 57 | // Hot module replacement requires that every child compiler has its own 58 | // cache. @see https://github.com/ampedandwired/html-webpack-plugin/pull/179 59 | childCompiler.plugin('compilation', function (compilation) { 60 | if (compilation.cache) { 61 | if (!compilation.cache[compilerName]) { 62 | compilation.cache[compilerName] = {}; 63 | } 64 | compilation.cache = compilation.cache[compilerName]; 65 | } 66 | }); 67 | 68 | // Compile and return a promise 69 | return new Promise(function (resolve, reject) { 70 | childCompiler.runAsChild(function (err, entries, childCompilation) { 71 | // Resolve / reject the promise 72 | if (childCompilation && childCompilation.errors && childCompilation.errors.length) { 73 | var errorDetails = childCompilation.errors.map(function (error) { 74 | return error.message + (error.error ? ':\n' + error.error : ''); 75 | }).join('\n'); 76 | reject(new Error('Child compilation failed:\n' + errorDetails)); 77 | } else if (err) { 78 | reject(err); 79 | } else { 80 | // Replace [hash] placeholders in filename 81 | var outputName = compilation.mainTemplate.applyPluginsWaterfall('asset-path', outputOptions.filename, { 82 | hash: childCompilation.hash, 83 | chunk: entries[0] 84 | }); 85 | // Restore the parent compilation to the state like it 86 | // was before the child compilation 87 | compilation.assets[outputName] = assetsBeforeCompilation[outputName]; 88 | if (assetsBeforeCompilation[outputName] === undefined) { 89 | // If it wasn't there - delete it 90 | delete compilation.assets[outputName]; 91 | } 92 | resolve({ 93 | // Hash of the template entry point 94 | hash: entries[0].hash, 95 | // Output name 96 | outputName: outputName, 97 | // Compiled code 98 | content: childCompilation.assets[outputName].source(), 99 | // childCompilation for multipageCache 100 | childCompilation: childCompilation 101 | }); 102 | } 103 | }); 104 | }); 105 | }; 106 | 107 | /** 108 | * Returns the child compiler name e.g. 'html-webpack-plugin for "index.html"' 109 | */ 110 | function getCompilerName (context, filename) { 111 | var absolutePath = path.resolve(context, filename); 112 | var relativePath = path.relative(context, absolutePath); 113 | return 'html-webpack-plugin for "' + (absolutePath.length < relativePath.length ? absolutePath : relativePath) + '"'; 114 | } 115 | -------------------------------------------------------------------------------- /lib/errors.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var PrettyError = require('pretty-error'); 3 | var prettyError = new PrettyError(); 4 | prettyError.withoutColors(); 5 | prettyError.skipPackage(['html-plugin-evaluation']); 6 | prettyError.skipNodeFiles(); 7 | prettyError.skip(function (traceLine) { 8 | return traceLine.path === 'html-plugin-evaluation'; 9 | }); 10 | 11 | module.exports = function (err, context) { 12 | return { 13 | toHtml: function () { 14 | return 'Html Webpack Plugin:\n
\n' + this.toString() + '
'; 15 | }, 16 | toJsonHtml: function () { 17 | return JSON.stringify(this.toHtml()); 18 | }, 19 | toString: function () { 20 | return prettyError.render(err).replace(/webpack:\/\/\/\./g, context); 21 | } 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /lib/loader.js: -------------------------------------------------------------------------------- 1 | /* This loader renders the template with underscore if no other loader was found */ 2 | 'use strict'; 3 | 4 | var _ = require('lodash'); 5 | var loaderUtils = require('loader-utils'); 6 | 7 | module.exports = function (source) { 8 | if (this.cacheable) { 9 | this.cacheable(); 10 | } 11 | var allLoadersButThisOne = this.loaders.filter(function (loader) { 12 | // Loader API changed from `loader.module` to `loader.normal` in Webpack 2. 13 | return (loader.module || loader.normal) !== module.exports; 14 | }); 15 | // This loader shouldn't kick in if there is any other loader 16 | if (allLoadersButThisOne.length > 0) { 17 | return source; 18 | } 19 | // Skip .js files 20 | if (/\.js$/.test(this.resourcePath)) { 21 | return source; 22 | } 23 | 24 | // The following part renders the tempalte with lodash as aminimalistic loader 25 | // 26 | // Get templating options 27 | var options = loaderUtils.parseQuery(this.query); 28 | // Webpack 2 does not allow with() statements, which lodash templates use to unwrap 29 | // the parameters passed to the compiled template inside the scope. We therefore 30 | // need to unwrap them ourselves here. This is essentially what lodash does internally 31 | // To tell lodash it should not use with we set a variable 32 | var template = _.template(source, _.defaults(options, { variable: 'data' })); 33 | // All templateVariables which should be available 34 | // @see HtmlWebpackPlugin.prototype.executeTemplate 35 | var templateVariables = [ 36 | 'compilation', 37 | 'webpack', 38 | 'webpackConfig', 39 | 'htmlWebpackPlugin' 40 | ]; 41 | return 'var _ = require(' + loaderUtils.stringifyRequest(this, require.resolve('lodash')) + ');' + 42 | 'module.exports = function (templateParams) {' + 43 | // Declare the template variables in the outer scope of the 44 | // lodash template to unwrap them 45 | templateVariables.map(function (variableName) { 46 | return 'var ' + variableName + ' = templateParams.' + variableName; 47 | }).join(';') + ';' + 48 | // Execute the lodash template 49 | 'return (' + template.source + ')();' + 50 | '}'; 51 | }; 52 | -------------------------------------------------------------------------------- /migration.md: -------------------------------------------------------------------------------- 1 | # Migrating from 1.x to 2.x 2 | 3 | ## Default config 4 | 5 | https://github.com/ampedandwired/html-webpack-plugin/tree/master/examples/default 6 | 7 | As of 2.x the `inject` options is set to true by default which means that all your javascript, css files and manifest files are injected automatically. See https://github.com/ampedandwired/html-webpack-plugin#configuration 8 | 9 | The default template has changed according to the inject option - but should behave like the previous version did. 10 | 11 | 12 | ```js 13 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 14 | 15 | module.exports = { 16 | // ... 17 | plugins: [ 18 | new HtmlWebpackPlugin() 19 | ] 20 | }; 21 | ``` 22 | 23 | ## Custom template 24 | 25 | This inject feature aims to simpify your custom templates: 26 | https://github.com/ampedandwired/html-webpack-plugin/tree/master/examples/custom-template 27 | 28 | ```js 29 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 30 | 31 | module.exports = { 32 | // ... 33 | plugins: [ 34 | new HtmlWebpackPlugin({ 35 | template: 'template.html' 36 | }) 37 | ] 38 | }; 39 | ``` 40 | 41 | ```html 42 | 43 | 44 | 45 | 46 | Webpack App 47 | 48 | 49 | 50 | 51 | ``` 52 | 53 | Although we did not specify any script tags or link tags they will be injected automatically and the result will be: 54 | ```html 55 | 56 | 57 | 58 | 59 | Webpack App 60 | 61 | 62 | 63 | 64 | 65 | 66 | ``` 67 | 68 | ## Templating and variables 69 | 70 | As of 2.x blueimp was replaced by lodash/underscore/ejs templates as they are more common. 71 | This also removes the `o` in template variables. ` ` becomes `` it also allows to escape variables by using `<%-` instead of `<%=` to prevent unexpected behaviours: `` 72 | 73 | # Loaders in templates 74 | Loaders may now be used inside the template the same way as you would expect in your javascript files. 75 | 76 | ```html 77 | 78 | <%= require('partial.html') %> 79 | ``` 80 | 81 | For the above example you would have to configure a [html](https://github.com/webpack/html-loader) and url/[file-loader](https://github.com/webpack/file-loader): 82 | 83 | ```js 84 | module: { 85 | loaders: [ 86 | {test: /\.png$/, loader: "file-loader"}, 87 | { 88 | test: /\.html$/, 89 | exclude: /index\.html$/, // you need to exclude your base template (unless you do not want this plugin own templating feature) 90 | loader: "html" 91 | } 92 | ] 93 | } 94 | ``` 95 | 96 | This configuration allows you to require partial html from your main `index.html` without being itself parsed by the html-loader instead of this html-webpack-plugin. 97 | 98 | 99 | ## Custom template engines 100 | 101 | Maybe you prefer jade or blueimp over underscore - or your project is using jade for the front end part. 102 | With 2.x you can use the webpack loaders either once only for the template as in the following example 103 | where we use jade (requires the [jade-loader](https://github.com/webpack/jade-loader)): 104 | 105 | ```js 106 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 107 | 108 | module.exports = { 109 | // ... 110 | plugins: [ 111 | new HtmlWebpackPlugin({ 112 | template: 'jade!template.jade' 113 | }) 114 | ] 115 | }; 116 | ``` 117 | 118 | or by configuring webpack to handle all `.jade` files: 119 | 120 | ```js 121 | module.exports = { 122 | // ... 123 | module: { 124 | loaders: [ 125 | { test: /\.jade$/, loader: 'jade' } 126 | ] 127 | }, 128 | plugins: [ 129 | new HtmlWebpackPlugin({ 130 | template: 'template.jade' 131 | }) 132 | ] 133 | }; 134 | ``` 135 | 136 | Please note that if you specify the loader and use 'jade!template.jade' webpack will try to apply the jade loader twice and fail. 137 | 138 | ## Isomorph apps 139 | 140 | As of the loader changes in 2.x the `templateContent` was removed. 141 | However you can still use custom javascript functions to generate a template: 142 | 143 | ```js 144 | module.exports = { 145 | // ... 146 | plugins: [ 147 | new HtmlWebpackPlugin({ 148 | template: 'template.js' 149 | }) 150 | ] 151 | }; 152 | ``` 153 | Simple template.js 154 | ```js 155 | module.exports = '...'; 156 | ``` 157 | More advanced template.js 158 | ```js 159 | module.exports = function(templateParams) { 160 | return '..'; 161 | }; 162 | ``` 163 | Using loaders inside a template.js 164 | ```js 165 | // This function has to return a string or promised string: 166 | module.exports = function(templateParams) { 167 | // Play around with the arguments and then use the webpack jade loader to load the jade: 168 | return require('./template.jade')({assets: templateParams.htmlWebpackPlugin.files}); 169 | }; 170 | ``` 171 | 172 | Unfortunately `__dirname` does not work correctly. 173 | If someone knows why I would love to merge a pull request. 174 | A good starting point might be here: https://github.com/webpack/webpack/issues/135 175 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "html-webpack-plugin-for-multihtml", 3 | "version": "2.30.2", 4 | "description": "Simplifies creation of HTML files to serve your webpack bundles", 5 | "main": "index.js", 6 | "files": [ 7 | "index.js", 8 | "default_index.ejs", 9 | "lib/" 10 | ], 11 | "scripts": { 12 | "prepublish": "npm run test", 13 | "pretest": "semistandard", 14 | "build-examples": "node examples/build-examples.js", 15 | "test": "jasmine" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/daifee/html-webpack-plugin-for-multihtml.git" 20 | }, 21 | "keywords": [ 22 | "webpack", 23 | "plugin", 24 | "html", 25 | "html-webpack-plugin", 26 | "html-webpack-plugin-for-multihtml" 27 | ], 28 | "author": "Charles Blaxland (https://github.com/ampedandwired)", 29 | "license": "MIT", 30 | "bugs": { 31 | "url": "https://github.com/daifee/html-webpack-plugin-for-multihtml/issues" 32 | }, 33 | "homepage": "https://github.com/daifee/html-webpack-plugin-for-multihtml", 34 | "semistandard": { 35 | "ignore": [ 36 | "examples/*/dist/**/*.*" 37 | ] 38 | }, 39 | "devDependencies": { 40 | "appcache-webpack-plugin": "^1.3.0", 41 | "css-loader": "^0.26.1", 42 | "dir-compare": "1.3.0", 43 | "es6-promise": "^4.0.5", 44 | "extract-text-webpack-plugin": "^1.0.1", 45 | "file-loader": "^0.9.0", 46 | "html-loader": "^0.4.4", 47 | "jade": "^1.11.0", 48 | "jade-loader": "^0.8.0", 49 | "jasmine": "^2.5.2", 50 | "rimraf": "^2.5.4", 51 | "semistandard": "8.0.0", 52 | "style-loader": "^0.13.1", 53 | "underscore-template-loader": "^0.7.3", 54 | "url-loader": "^0.5.7", 55 | "webpack": "^1.14.0", 56 | "webpack-recompilation-simulator": "^1.3.0" 57 | }, 58 | "dependencies": { 59 | "bluebird": "^3.4.7", 60 | "html-minifier": "^3.2.3", 61 | "loader-utils": "^0.2.16", 62 | "lodash": "^4.17.3", 63 | "pretty-error": "^2.0.2", 64 | "toposort": "^1.0.0" 65 | }, 66 | "peerDependencies": { 67 | "webpack": "1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3" 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /spec/CachingSpec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Integration tests for caching 3 | */ 4 | 5 | /* eslint-env jasmine */ 6 | 'use strict'; 7 | 8 | // Polyfill promisses for node 0.10.x 9 | if (!global.Promise) { 10 | require('es6-promise').polyfill(); 11 | } 12 | 13 | var path = require('path'); 14 | var webpack = require('webpack'); 15 | var rimraf = require('rimraf'); 16 | var WebpackRecompilationSimulator = require('webpack-recompilation-simulator'); 17 | var HtmlWebpackPlugin = require('../index.js'); 18 | 19 | var OUTPUT_DIR = path.join(__dirname, '../dist'); 20 | 21 | jasmine.getEnv().defaultTimeoutInterval = 30000; 22 | 23 | function setUpCompiler (htmlWebpackPlugin) { 24 | spyOn(htmlWebpackPlugin, 'evaluateCompilationResult').and.callThrough(); 25 | var compiler = new WebpackRecompilationSimulator(webpack({ 26 | entry: path.join(__dirname, 'fixtures/index.js'), 27 | output: { 28 | path: OUTPUT_DIR, 29 | filename: 'index_bundle.js' 30 | }, 31 | plugins: [htmlWebpackPlugin] 32 | })); 33 | return compiler; 34 | } 35 | 36 | function getCompiledModuleCount (statsJson) { 37 | return statsJson.modules.filter(function (webpackModule) { 38 | return webpackModule.built; 39 | }).length + statsJson.children.reduce(function (sum, childCompilationStats) { 40 | return sum + getCompiledModuleCount(childCompilationStats); 41 | }, 0); 42 | } 43 | 44 | describe('HtmlWebpackPluginCaching', function () { 45 | beforeEach(function (done) { 46 | rimraf(OUTPUT_DIR, done); 47 | }); 48 | 49 | it('should compile nothing if no file was changed', function (done) { 50 | var template = path.join(__dirname, 'fixtures/plain.html'); 51 | var htmlWebpackPlugin = new HtmlWebpackPlugin({ 52 | template: template 53 | }); 54 | var childCompilerHash; 55 | var compiler = setUpCompiler(htmlWebpackPlugin); 56 | compiler.run() 57 | // Change the template file and compile again 58 | .then(function () { 59 | childCompilerHash = htmlWebpackPlugin.childCompilerHash; 60 | return compiler.run(); 61 | }) 62 | .then(function (stats) { 63 | // Verify that no file was built 64 | expect(getCompiledModuleCount(stats.toJson())) 65 | .toBe(0); 66 | // Verify that the html was processed only during the inital build 67 | expect(htmlWebpackPlugin.evaluateCompilationResult.calls.count()) 68 | .toBe(1); 69 | // Verify that the child compilation was executed twice 70 | expect(htmlWebpackPlugin.childCompilerHash) 71 | .toBe(childCompilerHash); 72 | }) 73 | .then(done); 74 | }); 75 | 76 | it('should not compile the webpack html file if only a javascript file was changed', function (done) { 77 | var htmlWebpackPlugin = new HtmlWebpackPlugin(); 78 | var compiler = setUpCompiler(htmlWebpackPlugin); 79 | var childCompilerHash; 80 | compiler.run() 81 | // Change a js file and compile again 82 | .then(function () { 83 | childCompilerHash = htmlWebpackPlugin.childCompilerHash; 84 | compiler.simulateFileChange(path.join(__dirname, 'fixtures/index.js'), {footer: '//1'}); 85 | return compiler.run(); 86 | }) 87 | .then(function (stats) { 88 | // Verify that only one file was built 89 | expect(getCompiledModuleCount(stats.toJson())) 90 | .toBe(1); 91 | // Verify that the html was processed only during the inital build 92 | expect(htmlWebpackPlugin.evaluateCompilationResult.calls.count()) 93 | .toBe(1); 94 | // Verify that the child compilation was executed only once 95 | expect(htmlWebpackPlugin.childCompilerHash) 96 | .toBe(childCompilerHash); 97 | }) 98 | .then(done); 99 | }); 100 | 101 | it('should compile the webpack html file even if only a javascript file was changed if caching is disabled', function (done) { 102 | var htmlWebpackPlugin = new HtmlWebpackPlugin({ 103 | cache: false 104 | }); 105 | var childCompilerHash; 106 | var compiler = setUpCompiler(htmlWebpackPlugin); 107 | compiler.run() 108 | // Change a js file and compile again 109 | .then(function () { 110 | childCompilerHash = htmlWebpackPlugin.childCompilerHash; 111 | compiler.simulateFileChange(path.join(__dirname, 'fixtures/index.js'), {footer: '//1'}); 112 | return compiler.run(); 113 | }) 114 | .then(function (stats) { 115 | // Verify that only one file was built 116 | expect(getCompiledModuleCount(stats.toJson())) 117 | .toBe(1); 118 | // Verify that the html was processed on every run 119 | expect(htmlWebpackPlugin.evaluateCompilationResult.calls.count()) 120 | .toBe(2); 121 | // Verify that the child compilation was executed only once 122 | expect(htmlWebpackPlugin.childCompilerHash) 123 | .toBe(childCompilerHash); 124 | }) 125 | .then(done); 126 | }); 127 | 128 | it('should compile the webpack html if the template file was changed', function (done) { 129 | var template = path.join(__dirname, 'fixtures/plain.html'); 130 | var htmlWebpackPlugin = new HtmlWebpackPlugin({ 131 | template: template 132 | }); 133 | var childCompilerHash; 134 | var compiler = setUpCompiler(htmlWebpackPlugin); 135 | compiler.run() 136 | // Change the template file and compile again 137 | .then(function () { 138 | childCompilerHash = htmlWebpackPlugin.childCompilerHash; 139 | compiler.simulateFileChange(template, {footer: ''}); 140 | return compiler.run(); 141 | }) 142 | .then(function (stats) { 143 | // Verify that only one file was built 144 | expect(getCompiledModuleCount(stats.toJson())) 145 | .toBe(1); 146 | // Verify that the html was processed twice 147 | expect(htmlWebpackPlugin.evaluateCompilationResult.calls.count()) 148 | .toBe(2); 149 | // Verify that the child compilation was executed twice 150 | expect(htmlWebpackPlugin.childCompilerHash) 151 | .not.toBe(childCompilerHash); 152 | }) 153 | .then(done); 154 | }); 155 | }); 156 | -------------------------------------------------------------------------------- /spec/ExampleSpec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * These integration tests compile all cases from the example folder 3 | * and matches them against their dist folder 4 | */ 5 | 6 | /* eslint-env jasmine */ 7 | 'use strict'; 8 | 9 | // Workaround for css-loader issue 10 | // https://github.com/webpack/css-loader/issues/144 11 | if (!global.Promise) { 12 | require('es6-promise').polyfill(); 13 | } 14 | 15 | var path = require('path'); 16 | var webpack = require('webpack'); 17 | var rimraf = require('rimraf'); 18 | var fs = require('fs'); 19 | var webpackMajorVersion = require('webpack/package.json').version.split('.')[0]; 20 | 21 | var OUTPUT_DIR = path.join(__dirname, '../dist'); 22 | 23 | jasmine.getEnv().defaultTimeoutInterval = 30000; 24 | 25 | function runExample (exampleName, done) { 26 | var examplePath = path.resolve(__dirname, '..', 'examples', exampleName); 27 | var exampleOutput = path.join(OUTPUT_DIR, exampleName); 28 | var fixturePath = path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion); 29 | // Clear old results 30 | rimraf(exampleOutput, function () { 31 | var options = require(path.join(examplePath, 'webpack.config.js')); 32 | options.context = examplePath; 33 | options.output.path = exampleOutput; 34 | webpack(options, function (err) { 35 | var dircompare = require('dir-compare'); 36 | var res = dircompare.compareSync(fixturePath, exampleOutput, {compareSize: true}); 37 | 38 | res.diffSet.filter(function (diff) { 39 | return diff.state === 'distinct'; 40 | }).forEach(function (diff) { 41 | expect(fs.readFileSync(path.join(diff.path1, diff.name1)).toString()) 42 | .toBe(fs.readFileSync(path.join(diff.path2, diff.name2)).toString()); 43 | }); 44 | 45 | expect(err).toBeFalsy(); 46 | expect(res.same).toBe(true); 47 | done(); 48 | }); 49 | }); 50 | } 51 | 52 | describe('HtmlWebpackPlugin Examples', function () { 53 | it('appcache example', function (done) { 54 | runExample('appcache', done); 55 | }); 56 | 57 | it('custom-template example', function (done) { 58 | runExample('custom-template', done); 59 | }); 60 | 61 | it('default example', function (done) { 62 | runExample('default', done); 63 | }); 64 | 65 | it('favicon example', function (done) { 66 | runExample('favicon', done); 67 | }); 68 | 69 | it('html-loader example', function (done) { 70 | runExample('html-loader', done); 71 | }); 72 | 73 | it('inline example', function (done) { 74 | runExample('inline', done); 75 | }); 76 | 77 | it('jade-loader example', function (done) { 78 | runExample('jade-loader', done); 79 | }); 80 | 81 | it('javascript example', function (done) { 82 | runExample('javascript', done); 83 | }); 84 | 85 | it('javascript-advanced example', function (done) { 86 | runExample('javascript-advanced', done); 87 | }); 88 | 89 | it('sort manually example', function (done) { 90 | runExample('sort-manually', done); 91 | }); 92 | }); 93 | -------------------------------------------------------------------------------- /spec/fixtures/async.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = 'async'; 3 | -------------------------------------------------------------------------------- /spec/fixtures/common.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = 'common'; 4 | -------------------------------------------------------------------------------- /spec/fixtures/empty_html.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/spec/fixtures/empty_html.html -------------------------------------------------------------------------------- /spec/fixtures/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daifee/html-webpack-plugin-for-multihtml/650af3a74c6f95d2d89a048146db39817a948d2c/spec/fixtures/favicon.ico -------------------------------------------------------------------------------- /spec/fixtures/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./common'); 4 | 5 | require.ensure([], function () { 6 | require('./async'); 7 | }); 8 | 9 | document.body.innerHTML = document.body.innerHTML + '

index.js

'; 10 | -------------------------------------------------------------------------------- /spec/fixtures/invalid.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

Some unique text

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/legacy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

Some unique text

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: snow; 3 | } -------------------------------------------------------------------------------- /spec/fixtures/plain.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Example Plain file 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spec/fixtures/spaced_plain.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spec/fixtures/template.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta(http-equiv="Content-type" content="text/html; charset=utf-8") 5 | title Demo 6 | body 7 | p Some unique text 8 | each jsFile in htmlWebpackPlugin.files.js 9 | script(type="text/javascript" src!=jsFile) 10 | -------------------------------------------------------------------------------- /spec/fixtures/templateParam.js: -------------------------------------------------------------------------------- 1 | module.exports = function (templateParams) { 2 | return 'templateParams.compilation exists: ' + !!templateParams.compilation; 3 | }; 4 | -------------------------------------------------------------------------------- /spec/fixtures/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

Some unique text

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/theme.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./main.css'); 4 | require('./index.js'); 5 | -------------------------------------------------------------------------------- /spec/fixtures/util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./common'); 4 | document.body.innerHTML = document.body.innerHTML + '

util.js

'; 5 | -------------------------------------------------------------------------------- /spec/fixtures/webpackconfig.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 |

Public path is <%= webpackConfig.output.publicPath %>

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "stopSpecOnExpectationFailure": false, 7 | "random": true 8 | } 9 | --------------------------------------------------------------------------------