Compare commits

...

232 Commits

Author SHA1 Message Date
Vsevolod Ivanov ac3fe4ba1c fix ie11 css caching 2017-10-08 21:01:16 +03:00
Guy aedc623c77 Update README.md (#768) 2017-08-24 08:41:25 +02:00
Jan Nicklas 672f34bc98 Release 2.30.1 2017-07-31 16:47:29 +02:00
Thomas Sileghem 0cf580c628 fix(template): prevent undefined error in template loader (#754) 2017-07-31 16:45:25 +02:00
Jan Nicklas 7ca7cb7702 Add sort-manually examples for webpack 3 2017-07-31 11:37:04 +02:00
Jan Nicklas 09a96f5500 Release 2.30 2017-07-31 11:15:07 +02:00
Sergio Cinos cb150718a3 Uses a singleton cache to store the compilation stats (#723)
* Uses a singleton cache to store the compilation stats

* Use compilation.hash as the index for the cached stats

* Remove calls to compilation.getStats().toJson() because it is expensive and we actually don't need it

* Remove debugger statement

* Make changes compatible with webpack2

* Use json representation for chunks to avoid breaking `chunksSortMode`
2017-07-17 07:30:18 +02:00
skiny2015 6f15d185da Add manual sort mode 2017-07-03 17:10:10 +02:00
Anchen bd043db35d Change headReg and bodyReg to allow spaces (#709)
* change headReg and bodyReg to allow spaces

* change regex to only allow space before closing tag
2017-06-29 09:08:52 +02:00
Jan Nicklas 2cc10df68f Release 2.29.0 2017-06-25 01:23:51 +02:00
Rabbit 9665c63362 Add support for webpack 3(#707) 2017-06-24 23:29:56 +02:00
Yogeswaran 2751adeee9 README.md updated path property in output (#697)
In 2.6.1, 
   output: {
        path: 'dist',
        filename: 'app.bundle.js'
    }

give the below error.

The provided value "dist" is not an absolute path!

So made, path: 
output: {
    path: __dirname + '/dist',
    filename: 'index_bundle.js'
  }
2017-06-07 10:22:54 +02:00
Thomas Sileghem efd1f7886a chore(github): add issue_template.md (#677) 2017-05-29 15:47:40 +02:00
Nelson Chen d77b399f34 Update README.md (#688)
Small transpositional error.
2017-05-29 15:46:54 +02:00
Yong Heng 7a2aa84fdb Update template-option.md (#687) 2017-05-28 17:56:32 +02:00
Thomas Sileghem 9b272cfb2b make test passes for webpack@1 and webapck@2 (#642)
* test(ci): start testing using webpack@2

* test(examples): update examples output files

* chore(travis): remove deprecaded node versions
2017-05-10 13:44:44 +02:00
Erwann Mest 7a43f1043a docs(README): clearer explanation about minify (#666)
As read like this, I thought I had to import html-minifier and give the object as parameter like:

```javascript
import htmlMinifier from 'html-minifier'

new HtmlWebpackPlugin({
        template: 'src/index.html',
        minify: htmlMinifier,
      }),
```
2017-05-10 13:42:12 +02:00
Jouni Kantola cc6ba28688 Link plugin for inlining chunk manifest (#647) 2017-04-22 16:00:59 +02:00
Tarjei Huse b4bd75f5fe Make example more explicit about filename (#649)
I lost half a day because I also had a file loader for .html and somehow the output got garbled.
2017-04-22 16:00:30 +02:00
Cristian Leyes b8fd1427bc Update template-option.md (#590) 2017-02-13 09:38:56 +01:00
Evan Scott 5a764334c0 Add link media plugin to README (#591) 2017-02-13 09:38:37 +01:00
Jason eeb94b565f this.resourcePath will avoid not skipping resource file with query params. (#588) 2017-02-09 11:08:06 +01:00
Jan Nicklas 810771e316 Update README.md 2017-02-05 12:23:59 +01:00
Radu Micu dc32a23996 Added new preload plugin and description update (#580)
Added a description for `html-webpack-harddisk-plugin` and the new `preload-webpack-plugin` plugin from Google.
2017-02-05 12:22:19 +01:00
Jan Nicklas eb6a54fd46 Run tests against webpack 1 2017-02-01 08:54:11 +01:00
Jan Nicklas 4ac7bfa8dc Adjust example loader configuration 2017-02-01 08:52:51 +01:00
Jan Nicklas ef1915a4ee Update urls 2017-02-01 08:47:58 +01:00
Jan Nicklas e71b512548 Add bithound configuration 2017-01-30 00:12:05 +01:00
Jan Nicklas d45e980e7d Update readme 2017-01-29 23:51:03 +01:00
Mike Evans 2d5c42ff18 chunks passed to alter-assets event (#574) 2017-01-29 15:07:05 +01:00
Jan Nicklas 73a01bdcaf Release 2.28.0 2017-01-29 14:48:23 +01:00
Jan Nicklas 9bdb6189ea Release 2.27.1 2017-01-29 14:46:14 +01:00
Jan Nicklas 61ec618c53 Release 2.27.0 2017-01-29 14:43:49 +01:00
Peter Marton 9d7aa21377 fix(chunksorter): webpack2 compatible (#569) 2017-01-29 14:34:25 +01:00
Kees Kluskens cbbb4a9aec Document `yarn link` before running tests (#570) 2017-01-29 14:08:12 +01:00
jharris4 41dce566c3 Add link to html-webpack-include-assets-plugin (#560) 2017-01-25 09:27:53 +01:00
Arseny Razin 6dd753c3ba Fix travis-ci: set tty size (#552) 2017-01-21 19:29:07 +01:00
Arseny 7a781a4120 Fix template compilation for es6 modules (#550) 2017-01-20 12:11:09 +01:00
Peach 1b4f8efe94 Fix template path resolving regexp to support loader query parameters (#542) 2017-01-11 10:09:30 +01:00
Jan Nicklas 26c95e9c4b Update README.md 2017-01-05 10:02:58 +01:00
Jan Nicklas 45099373d9 Update README.md 2017-01-05 10:01:43 +01:00
Mike Evans d07d1ebf66 updated README (#539) 2017-01-05 09:56:48 +01:00
Jan Nicklas 2f4c88355c Fix unit tests for node 0.12 2017-01-04 08:40:48 +01:00
Jan Nicklas ecc0784af5 Fix unit tests for node 0.12 2017-01-04 08:38:08 +01:00
Mike Evans d22c23066a Allows events to add no-value attributes 2017-01-03 22:22:30 +01:00
Jan Nicklas 90c6b90279 Add yarn lock file 2016-12-31 00:28:26 +01:00
Jan Nicklas f3abe9f6ae Update dependencies 2016-12-31 00:17:23 +01:00
Jan Nicklas be5d67af5b Release 2.25.0 2016-12-30 20:13:25 +01:00
Jan Nicklas 9046e46d12 Cleaner webpack compilation output 2016-12-30 20:09:42 +01:00
Simen Bekkhus 8fbee6a732 Allow webpack 2 rc (#526) 2016-12-21 14:31:55 +01:00
James Ye ef41d98bd0 Update README.md (#519) 2016-12-08 11:21:59 +01:00
Leonard Kinday 06b49ff363 Typos and edits in README.md (#502) 2016-11-25 14:50:14 +01:00
Tal Ater 6657d38873 Typo fixed in README.md (#498) 2016-11-21 13:31:16 +01:00
Jan Nicklas e7c44ab1b5 Update README.md 2016-11-16 12:23:21 +01:00
Jan Nicklas b2db3f91e9 Refactor chunk filtering 2016-11-15 09:24:30 +01:00
Jan Nicklas ff249a57b4 Update README.md 2016-11-12 19:47:31 +01:00
Jan Nicklas 8ed2159b9d Improve readability 2016-11-11 09:52:41 +01:00
Jan Nicklas 03320747dc Release 2.24.1 2016-10-31 08:56:36 +01:00
Andrea Ascari bac1cd4469 Hide event deprecated warning of 'applyPluginsAsyncWaterfall' for html-webpack-plugin-after-emit and improve the warning message. (#478) 2016-10-31 08:52:31 +01:00
Jan Nicklas fe5580985e Update integration tests to match the current webpack compiler 2016-10-29 09:03:48 +02:00
Jan Nicklas 1a2e2b3e94 Release 2.24.0 2016-10-21 10:11:17 +02:00
Andrea Ascari 4e29b022b8 Made before and after "html-processing" events use callback value (#442)
* Used returned value from applyPluginsAsyncWaterfall promise instead of referred object.
* Removed the possibility to alter 'html' and 'assets' in 'html-webpack-plugin-alter-asset-tags'.
* Added warning for non returned result from 'html-webpack-plugin-after-html-processing' and fixed tests.
2016-10-12 14:23:13 +02:00
christoph peter 9757d3df30 replace [hash] in publicPath of favicon (#441) 2016-09-26 12:29:30 +02:00
Tim Oxley 03758f46cc Fix Readme Typo (#435)
`s/inject/template`
2016-09-18 08:55:40 +02:00
Jan Nicklas 62c9e70113 Merge pull request #426 from insin/patch-1
Update peerDependencies to support use with Webpack 2 beta and npm2
2016-09-14 13:19:17 +02:00
Jonny Buchanan 4e9582556f Update peerDependencies to support use with Webpack 2 beta and npm2 2016-09-10 09:34:08 +10:00
Jan Nicklas 8b79742f6f Merge pull request #406 from adjohnson916/patch-1
Capitalize some acronyms in README.
2016-08-25 17:37:45 +02:00
Anders D. Johnson 55d5370b71 Capitalize some acronyms in README. 2016-08-20 07:58:33 -05:00
Jan Nicklas 263b5b6bde Update dependencies 2016-08-12 09:36:22 +02:00
Jan Nicklas 9d00ad79ed Update template-option.md 2016-08-02 14:49:28 +02:00
Jan Nicklas 93b69a3646 Merge pull request #383 from Madalosso/patch-1
Update template-option.md
2016-07-16 13:33:22 +02:00
Otávio Migliavacca Madalosso 91ba00ea5a Update template-option.md
fix a missing ' ] ' on loader instruction
2016-07-14 15:09:38 -03:00
Jan Nicklas e493064c34 Merge pull request #375 from mgol/empty-templateContent
Don't treat templateContent set to an empty string as not specified
2016-07-06 23:59:39 +02:00
Michał Gołębiowski d0105fd7a7 Don't treat templateContent set to an empty string as not specified
Fix #355
2016-07-06 13:30:54 +02:00
Jan Nicklas fb18de08a0 Update template-option.md 2016-07-02 13:01:24 +02:00
Jan Nicklas 8fbbf69e50 Update dependencies 2016-07-02 12:51:07 +02:00
Jan Nicklas 2f2c88bbdb Update dependencies and integration tests 2016-07-02 12:30:16 +02:00
Jan Nicklas d1f9330715 Update README.md 2016-07-02 12:21:13 +02:00
Jan Nicklas c6b45b314e Better error handling (#354)
Add some docs
2016-07-02 12:17:11 +02:00
Jan Nicklas 943c555665 Merge pull request #354 from vincentngthu/master
Handle err before any logic in promise return by compileTemplate
2016-06-15 18:50:08 +02:00
Zhanwei Wu 4e6f902cab optimized err handling logic 2016-06-15 18:36:24 +08:00
wuzhanwei e493348953 Update compiler.js
ref #353 handle err before any logic in promise return by compileTemplate
2016-06-15 13:40:25 +08:00
Jan Nicklas fa25bd7718 Merge pull request #345 from ampedandwired/feature/alter-tags
Add 'html-webpack-plugin-alter-asset-tags'
2016-06-12 13:33:38 +02:00
Jan Nicklas 6c516a85c2 Merge pull request #350 from victorwpbastos/patch-1
small typo
2016-06-12 13:32:41 +02:00
Victor Bastos b9f0c9e92f small typo 2016-06-10 15:27:32 -03:00
Jan Nicklas 86badc3d6e Add documentation for `html-webpack-plugin-alter-asset-tags` 2016-06-10 14:11:01 +02:00
Jan Nicklas c43bb4359f Add 'html-webpack-plugin-alter-asset-tags' 2016-06-10 08:17:41 +02:00
Jan Nicklas c2982a8977 Merge pull request #343 from ampedandwired/fixes/dependency-sort
Exclude chunks works now even if combined with dependency sort
2016-06-10 08:15:37 +02:00
Jan Nicklas c54273563a Exclude chunks works now even if combined with dependency sort 2016-06-09 23:04:19 +02:00
Jan Nicklas f3e4ead0f5 Rebuild webpack 2 test fixtures 2016-06-09 23:03:04 +02:00
Jan Nicklas c229fcbab2 Add html-webpack-plugin-alter-chunks event 2016-05-30 11:59:17 +02:00
Jan Nicklas 998ebf03eb Update CHANGELOG.md 2016-05-29 13:18:16 +02:00
Jan Nicklas 3a10699319 Update dependencies 2016-05-29 13:12:39 +02:00
Jan Nicklas 390635a519 Release 2.17.0 2016-05-13 13:43:19 +02:00
Jan Nicklas 7230b6a537 Update tests for webpack beta 2016-05-13 13:22:08 +02:00
Patrick Burtchaell b718dc1c2c Add type attribute to script element
* Update index.js to add type attribute
* Update tests
* Build examples to update HTML
* Update CHANGELOG
2016-05-13 13:18:58 +02:00
Jan Nicklas 0952b3a810 Release v2.16.2 2016-05-13 11:46:16 +02:00
Thomas Grainger 05d6694743 ∃ ∀ hot-update.js for isHotUpdateCompilation 2016-05-13 11:46:15 +02:00
Jan Nicklas 52f53faf45 Recompile templates for newest beta version 2016-05-13 11:45:52 +02:00
Jan Nicklas a252bca92c Update README.md 2016-05-03 08:43:08 +02:00
Jan Nicklas 3e751b7046 Release 2.16.1 2016-05-02 18:08:04 +02:00
Jan Nicklas c6f59019b3 Use travis matrix 2016-05-02 14:27:16 +02:00
Jan Nicklas 10058066d7 Merge pull request #281 from dtinth/patch-1
Don’t emit the html for hot-update compilation.
2016-04-30 19:53:49 +02:00
Jan Nicklas 129c42e8d0 Add tests for node 6 2016-04-27 08:48:47 +02:00
Jan Nicklas cdd97c3279 Adjust tests for webpack 2 beta 2016-04-25 19:27:03 +02:00
Jan Nicklas 0a9d8e8417 Update dependencies 2016-04-25 19:16:19 +02:00
Jan Nicklas 20ac9e9fc5 Update README.md 2016-04-18 13:45:38 +02:00
Jan Nicklas b9ae47983c Merge pull request #295 from zzuieliyaoli/master
add demo code about events
2016-04-18 13:44:03 +02:00
zzuieliyaoli 72c33d7b3e remove additional word 2016-04-18 19:40:54 +08:00
Jan Nicklas 37bf50d662 Merge pull request #279 from ampedandwired/feature/hash-names
Support hashes in filenames
2016-04-18 13:16:02 +02:00
Jan Nicklas bfed3a29cc Add support for dynamic filenames 2016-04-18 13:00:48 +02:00
Jan Nicklas 765002458b Use loadash instead of object assign for old node versions 2016-04-18 13:00:48 +02:00
Jan Nicklas c0b730f25d Support hashes in filenames 2016-04-18 13:00:48 +02:00
zzuieliyaoli b8532f436d add demo code about events 2016-04-18 16:46:59 +08:00
Jan Nicklas 4fc5328411 Merge pull request #289 from numical/master
Corrected README.md Events example code
2016-04-13 07:16:26 +02:00
Mike Evans 4dc976e396 corrected README.md Events example code 2016-04-12 09:55:22 +01:00
Jan Nicklas f89eb945ec Update webpack.config.js 2016-04-04 15:14:25 +02:00
Thai Pangsakulyanont 25fd764e16 Don’t emit the html for hot-update compilation.
webpack-dev-server@2.0.0-beta seems to be emitting hot update bundles separately from the full bundle. This makes HtmlWebpackPlugin mistake it for the real bundle, and generates a HTML file that looks like this:

```html
<script src="0.8f9c33574d86dd9eab0d.hot-update.js"></scriptt>
```

This commit uses quite a hack to check if the emitted bundle is a hot-update bundle, and skip emitting `index.html` file.
2016-04-02 16:47:06 +07:00
Jan Nicklas c776cdd586 Update README.md 2016-03-29 18:48:48 +02:00
Jan Nicklas 3ad0f9fba6 Fix test for webpack2 2016-03-29 18:38:27 +02:00
Jan Nicklas a009406838 Write changelog 2016-03-29 18:32:23 +02:00
Jan Nicklas 4ab5f1bdb1 Merge pull request #267 from ampedandwired/feature/webpack2-tests
Feature/webpack2 tests
2016-03-24 21:49:38 +01:00
Jan Nicklas def0703e71 Add inline tests for webpack 2 2016-03-23 11:13:38 +01:00
Jan Nicklas 29871bd0f5 Fix dist files 2016-03-23 11:06:11 +01:00
Jan Nicklas fab60bed44 Fix sorting for webpack2 2016-03-23 11:06:11 +01:00
Jan Nicklas 831cbdecb8 Ensure that all tests pass for webpack2
Use sort mode "dependency" as default for webpack2
2016-03-23 11:06:11 +01:00
Jan Nicklas 40b065808c Add example results for webpack-2 2016-03-23 11:06:11 +01:00
Jan Nicklas 935eefb291 Move web pack 1 example results into a subfolder 2016-03-23 11:06:11 +01:00
Jan Nicklas f616f2e22f Add inlining 2016-03-23 10:07:26 +01:00
Jan Nicklas a04434a225 Add unit tests for absolute file names 2016-03-23 09:20:34 +01:00
Evan You e4e9555209 support absolute filenames 2016-03-23 03:08:46 -04:00
Jan Nicklas 9066ad2ad3 Merge pull request #263 from ampedandwired/feature/recompilation-tests
Add caching tests
2016-03-21 12:02:09 +01:00
Jan Nicklas 4114403df2 Count built files 2016-03-21 00:10:43 +01:00
Jan Nicklas 58681c3bdb Release v2.12.0 2016-03-20 15:40:12 +01:00
Jan Nicklas 854242a24c Merge basic webpack 2 support #225
# By Alexander Wesolowski (1) and Jan Nicklas (1)
* commit 'c883a8663c07da04cb6b713bca45ed65a93f7e5c':
  Move template.js into loader.js
  Fix Webpack2 compatibility. Closes #213.
2016-03-20 15:38:02 +01:00
Jan Nicklas 890353b6e4 Add caching tests 2016-03-20 15:34:59 +01:00
Jan Nicklas 75adbcb066 Release 2.11.0 2016-03-20 14:14:26 +01:00
Jan Nicklas 67ca550b99 Merge pull request #249 from sandeep45/master
build public path with correct hash value
2016-03-17 07:04:33 +01:00
Sandeep Arneja eb01c774f2 Added a unit test to ensure that hashes are resolved correctly when used as the directory name holding the bundle file 2016-03-16 12:20:08 -04:00
Jan Nicklas b613824bf8 Merge pull request #255 from fetch/xhtml
Add xhtml option to make link tags self-closing
2016-03-15 14:48:18 +01:00
Koen Punt f8abc156b5 Add xhtml option to readme and add tests 2016-03-15 13:51:41 +01:00
Jan Nicklas 7af56dbb99 Merge pull request #254 from mistadikay/master
Update changelog
2016-03-15 12:56:07 +01:00
Koen Punt bf5901e5c0 Add xhtml option to make link tags self-closing 2016-03-15 12:37:18 +01:00
mistadikay c4587c1443 add missing changelog from 1.5.0 to 2.10.0 2016-03-15 11:01:20 +07:00
mistadikay 5ca4d1610a rename CHANGES.md to CHANGELOG.md 2016-03-15 11:00:59 +07:00
Jan Nicklas 13e9a2ed2f Update README.md 2016-03-10 11:26:12 +01:00
Jan Nicklas 4a817ab2c3 v2.10.0
switch to jasmine 2 #241
add before-html-generation event #240
Properly throw an error in compiler even when childCompilation is missing #243
Update dependencies
2016-03-10 11:14:18 +01:00
Sandeep Arneja 419c2e6121 build public path with correct hash value 2016-03-09 17:45:42 -05:00
Jan Nicklas 07d410d477 Merge pull request #246 from michael-wolfenden/add-compilation-property-to-templateParams
Add additional compilation property to the templateParam object
2016-03-02 08:37:12 +01:00
Michael Wolfenden 3005cec0f9 Add additional compilation property to the templateParam object 2016-03-02 13:28:26 +10:00
Jan Nicklas f707c98d32 Merge pull request #240 from SimenB/event-before-function-invocation
Add before-html-generation event
2016-02-29 18:51:16 +01:00
Jan Nicklas 183eab1e83 Merge pull request #241 from SimenB/jasmine-2
Upgrade jasmine to 2
2016-02-29 18:50:13 +01:00
Jan Nicklas 24a4ea0df4 Merge pull request #242 from SimenB/travis
Test on alle LTS releases of Node
2016-02-29 18:49:43 +01:00
Jan Nicklas 4d3c7319ed Merge pull request #243 from denis-sokolov/patch-1
Properly throw an error in compiler even when childCompilation is missing
2016-02-29 18:49:32 +01:00
Denis Sokolov 2fd075ff21 Properly throw an error in compiler even when childCompilation is missing
For some errors, no other parameters to the function are even given,
only the error object in `err`.
2016-02-29 18:12:35 +02:00
Simen Bekkhus dbd508027b Test on alle LTS releases of Node 2016-02-28 09:32:57 +01:00
Simen Bekkhus 75175a6297 Upgrade jasmine to 2 2016-02-28 09:30:26 +01:00
Simen Bekkhus 3897896265 Add before-html-generation event
This allows you to add assets to the html when not using
injection
2016-02-27 18:28:41 +01:00
Jan Nicklas 4a69c9a013 Merge pull request #235 from mc-zone/master
Add chunk hash to `assets.chunks`
2016-02-27 02:01:19 +01:00
Jan Nicklas 05b2abde73 Merge pull request #238 from JSteunou/patch-2
Fix regex
2016-02-27 02:00:40 +01:00
mc-zone 313a83115a add test 2016-02-26 20:57:49 +08:00
Jérôme Steunou a21b79aeb1 Fix regex
even if it works without, because catching any character, better to be explicit.
2016-02-26 09:44:04 +01:00
Ma Cheng 0b4d7383ea Add chunk hash to `assets.chunks`
Add chunk hash to `assets.chunks` so can use it in template.
For some version control requirements, chunk hash may be more useful than compilation hash.
For example, if there are two chunks in page, but only one of them is changed, chunk hash is more cache-friendly.
2016-02-23 19:09:18 +08:00
Jan Nicklas 73a5ef7bef Merge pull request #231 from JSteunou/patch-1
Explicit documentation about sub-templating
2016-02-19 16:17:32 +01:00
Jérôme Steunou 19f0eeb0d2 Explicit documentation about sub-templating
Maybe I should split this PR into 2 commits, you will tell me

* there was one comma `;` in the example that made my build crash.
* judging by the hard time people have when using this feature, including myself, there is clearly some miss-understanding #230 #202 #198 #176
2016-02-19 10:54:27 +01:00
Jan Nicklas 713643f84f v2.9.0 Fix favicon path (#185 #208 #215) 2016-02-17 13:17:23 +01:00
Jiri Kolarik b65c39c2f1 fix favicon location 2016-02-17 13:14:31 +01:00
Jan Nicklas e3c7975d78 Remove webpack 2 tests for now 2016-02-16 18:33:13 +01:00
Jan Nicklas c883a8663c Move template.js into loader.js 2016-02-16 10:55:31 +01:00
Alexander Wesolowski a5174be6f2 Fix Webpack2 compatibility. Closes #213. 2016-02-16 09:51:25 +01:00
Jan Nicklas 617abd6a4d Update .travis.yml 2016-02-16 08:59:55 +01:00
Jan Nicklas 18b4c4c912 Test webpack 1 and 2 2016-02-16 08:50:16 +01:00
Jan Nicklas 7f81466c14 v2.8.2: Support relative urls on windows (#205) 2016-02-16 08:25:12 +01:00
Jan Nicklas 63e4ad6fc7 Support relative urls on windows (#205) 2016-02-16 08:05:15 +01:00
Jan Nicklas 453975ee0f Improve sorting tests 2016-02-16 07:56:36 +01:00
Jan Nicklas 97cd17083a Merge pull request #217 from jpetitcolas/patch-1
[RFR] Fix typo
2016-02-12 09:33:15 +01:00
Jonathan Petitcolas 07fb7560b6 Fix typo 2016-02-11 15:12:39 +01:00
Jan Nicklas 2ed44aad42 Merge pull request #214 from foglerek/master
Accomodated for change to Loader API in Webpack 2
2016-02-10 13:04:40 +01:00
Alexander Wesolowski 6818eedc2d Accomodated for change to Loader API in Webpack 2
issue#213
2016-02-10 01:23:06 -08:00
Jan Nicklas 99a8d7e4fd v2.8.1: Improve caching - fixes #204 2016-02-03 18:03:22 +01:00
Jan Nicklas 3f38901758 v2.8.0: Add chunk sort mode dependency 2016-02-03 18:00:27 +01:00
Jan Nicklas 5fb1eca651 Merge pull request #187 from SpaceK33z/add-jade-dep
Add jade dev dependency to fix tests
2016-01-28 00:23:36 +01:00
Jan Nicklas 0bdc43f478 Merge pull request #192 from ruehl/dependency-sort
Implemented new chunk sorting mode 'dependency'
2016-01-28 00:08:28 +01:00
Jan Nicklas 6f008c431c Merge pull request #195 from Foxandxss/patch-1
Fix typo in readme
2016-01-27 10:19:56 +01:00
Jesús Rodríguez ea9782d1b9 Fix typo in readme 2016-01-27 10:18:48 +01:00
Jan Nicklas ac60b8e290 Update readme 2016-01-27 09:53:09 +01:00
Christian Ruehl 36c762a834 ChunkSorter now implements all different strategies for sorting chunks available through chunksSortMode parameter. HtmlPlugin rewritten to use extended ChunkSorter. 2016-01-26 20:28:02 +01:00
Christian Rühl 3fedf6ac33 Implemented new chunk sorting mode 'dependency', which attempts to order chunks based on their relation within the dependency tree as devised by Webpack.
Added unit test for new sorting mode.

Fixed a few typos in other unit tests...sorry, couldn't resist ;-)
2016-01-25 15:13:19 +01:00
Jan Nicklas f8de79cce5 Merge pull request #188 from graingert/patch-1
Fix typos and grammar
2016-01-25 02:32:22 +01:00
Thomas Grainger bee33c4081 Fix typos and grammar 2016-01-24 20:51:14 +00:00
Jan Nicklas 78c4e32bb0 Update README.md 2016-01-24 19:31:00 +01:00
Jan Nicklas d49c2207c5 Fix migration guide link 2016-01-24 19:30:22 +01:00
Jan Nicklas cd77e8a727 Add migration guide 2016-01-24 19:29:03 +01:00
Jan Nicklas 70df65d9e5 Add support for require in js templates 2016-01-24 19:07:09 +01:00
Kees Kluskens 01d7dd602d Add jade dev dependency to fix tests
3 tests failed without this dependency.
2016-01-22 00:12:27 +01:00
Jan Nicklas 9e8259ae26 Merge 2.x into master 2016-01-20 17:12:01 +01:00
Jan Nicklas 08fb649710 Update batch link for windows tests 2016-01-20 17:04:27 +01:00
Jan Nicklas 8eb8c86be4 Fix relative windows path 2016-01-20 16:51:07 +01:00
Jan Nicklas bf48112fa9 Use semistandard code style 2016-01-20 16:50:16 +01:00
Jan Nicklas a35e5e3b84 Add appveyor file 2016-01-20 16:24:16 +01:00
Jan Nicklas d5c4e08457 Minor refactoring because of #179
Release 2.6.5
2016-01-19 14:52:25 +01:00
Jan Nicklas c4ee1738e7 Add some documentation for the hmr fix 2016-01-19 07:38:21 +01:00
Jan Nicklas 3da52a6001 Merge pull request #178 from sokra/windows
Windows support
2016-01-19 07:31:41 +01:00
Jan Nicklas f74928b6e6 Merge pull request #179 from sokra/cache-in-child
Child compilation must use a separate cache object
2016-01-19 07:31:16 +01:00
Tobias Koppers b42074844c Use a separate cache for the child compilation.
Sharing the cache cause bad issues with wrong module ids.
2016-01-18 23:48:42 +01:00
Tobias Koppers b286cea3d2 fixed windows issue (backslash is escape char) 2016-01-18 23:45:22 +01:00
Jan Nicklas 9e7cc462ba Add example results and add them to the test suite 2016-01-18 14:48:39 +01:00
Jan Nicklas e566dac40d Fix context 2016-01-18 14:47:54 +01:00
Jan Nicklas df2e4728ab Fix default template name 2016-01-18 14:47:26 +01:00
Jan Nicklas 0450b45c40 Prevent parsing the base template with the html-loader 2016-01-18 11:57:13 +01:00
Jan Nicklas 26c87253ca Release 2.6.2 2016-01-15 17:05:48 +01:00
Jan Nicklas f108db0737 Merge pull request #173 from creeperyang/feature/loaders
Fix lodash as dependency #172
2016-01-15 15:31:45 +01:00
creeperyang 5ec7e2dc59 require and resolve lodash internal, fix #172 2016-01-15 21:38:52 +08:00
Jan Nicklas 64ff092c1f Add app cache example 2016-01-15 11:05:51 +01:00
Jan Nicklas 954aa98339 Merge pull request #166 from SimenB/patch-2
Add syntax highlighting to event example
2016-01-12 19:05:55 +01:00
Simen Bekkhus aadf384a62 Add syntax highlighting to event example 2016-01-12 10:25:19 +01:00
Jan Nicklas ad02508db1 Merge pull request #165 from SimenB/patch-2
Include the whole lib-directory
2016-01-12 10:22:41 +01:00
Simen Bekkhus dd1518a260 Include the whole lib-directory 2016-01-12 10:01:55 +01:00
Jan Nicklas c6cb00c4fe Fixes #164 - Error: Cannot find module './lib/compiler.js' 2016-01-12 09:31:48 +01:00
Jan Nicklas 70259ea4b9 Invalidate cache on error 2016-01-12 09:30:32 +01:00
Jan Nicklas 579839b0a6 Update readme 2016-01-08 10:20:36 +01:00
Jan Nicklas 9622634173 Release 1.7.0 2015-11-23 14:14:12 +01:00
Jan Nicklas 796bcbe19c Add unit tests for chunk sort 2015-11-23 14:13:32 +01:00
Jan Nicklas c556925234 Work around css-loader issue during testing 2015-11-23 13:38:20 +01:00
Jan Nicklas 2ef2ead8ff Upgrade dependencies 2015-11-23 12:25:17 +01:00
Jan Nicklas 6262921f3f Add missing use strict statements 2015-11-23 12:24:55 +01:00
Jan Nicklas 0b0e0205fc Allow to disable sorting or pass a custom sort function 2015-11-23 12:00:38 +01:00
Jan Nicklas 83ad4de679 Merge pull request #115 from vyorkin/bugfix/skip-async-chunks
Don't insert chunks that is not 'initial'
2015-11-23 11:41:01 +01:00
Vasiliy Yorkin 10e8b5e0a4 Don't insert chunks that is not 'initial' 2015-11-10 21:24:51 +03:00
Jan Nicklas 0a1f3a4464 Release 1.6.2 2015-10-08 21:59:10 +02:00
Jan Nicklas b8b7586717 Merge pull request #92 from thomasguillory/fix/publicPath-hash
FIX missing [hash] interpolation in publicPath
2015-10-04 16:34:38 +02:00
Thomas Guillory 41a255a2f1 FIX missing [hash] interpolation in publicPath
Webpack gives the possibility to use the build [hash] in
output.publicPath option:
https://webpack.github.io/docs/long-term-caching.html

However HtmlWebpackPlugin is reading directly the raw option, preventing the
user to use this option when using it.
2015-10-02 16:13:59 +02:00
223 changed files with 12753 additions and 1319 deletions

9
.bithoundrc Normal file
View File

@ -0,0 +1,9 @@
{
"ignore": [
"**/examples/**",
"**/node_modules/**",
],
"test": [
"**/spec/**"
]
}

79
.github/issue_template.md vendored Normal file
View File

@ -0,0 +1,79 @@
<!-- CLICK "Preview" FOR INSTRUCTIONS IN A MORE READABLE FORMAT -->
## Prerequisites
- 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.
- Support questions are better asked in one of the following locations:
- [Stack Overflow](http://stackoverflow.com/questions/tagged/html-webpack-plugin)
- Ensure the issue isn't already reported.
- Should be reproducible with the latest version of `html-webpack-plugin`.
- (Ensure `npm ls html-webpack-plugin` matches ![](https://img.shields.io/npm/v/html-webpack-plugin.svg))
*Delete the above section and the instructions in the sections below before submitting*
## Description
If this is a feature request, explain why it should be added. Specific use-cases are best.
For bug reports, please provide as much *relevant* info as possible.
### Error Message & Stack Trace
```
COPY THE ERROR MESSAGE, INCLUDING STACK TRACE HERE
```
### Config
Copy the relevant section from `webpack.config.js`:
```js
module.exports = {
entry: 'app.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
module: {
rules: [
...
]
}
plugins: [
new HtmlWebpackPlugin(),
...
]
}
```
Copy your template file:
```html
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
</head>
<body>
</body>
</html>
```
## Relevant Links
- If your project is public, link to the repo so we can investigate directly.
- **BONUS POINTS:** Create a [minimal reproduction](http://stackoverflow.com/help/mcve) and upload it to GitHub. This will get you the fastest support.
## Environment
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:
```
node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
npm --version
npm ls webpack
npm ls html-webpack-plugin
```

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/node_modules/ /node_modules/
/dist/ /dist/
examples/*/dist
npm-debug.log npm-debug.log

View File

@ -1,95 +0,0 @@
{
// From JSHint Default Configuration File
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
"eqeqeq" : true, // true: Require triple equals (===) for comparison
"forin" : false, // true: Require filtering for..in loops with obj.hasOwnProperty()
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
"immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
"indent" : 2, // {int} Number of spaces to use for indentation
"latedef" : false, // true: Require variables/functions to be defined before being used
"newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
"noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
"nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
"plusplus" : false, // true: Prohibit use of `++` & `--`
"quotmark" : false, // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
"unused" : true, // true: Require all defined variables be used
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
"maxparams" : false, // {int} Max number of formal params allowed per function
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
"maxstatements" : false, // {int} Max number statements per function
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
"maxlen" : false, // {int} Max number of characters per line
// Relaxing
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
"boss" : false, // true: Tolerate assignments where comparisons would be expected
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // true: Tolerate use of `== null`
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
// (ex: `for each`, multiple try/catch, function expression…)
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
"funcscope" : false, // true: Tolerate defining variables inside control statements
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
"iterator" : false, // true: Tolerate using the `__iterator__` property
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
"laxcomma" : false, // true: Tolerate comma-first style coding
"loopfunc" : true, // true: Tolerate functions being defined in loops
"multistr" : false, // true: Tolerate multi-line strings
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
"notypeof" : false, // true: Tolerate invalid typeof operator values
"proto" : false, // true: Tolerate using the `__proto__` property
"scripturl" : false, // true: Tolerate script-targeted URLs
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
"validthis" : false, // true: Tolerate using this in a non-constructor function
// Environments
"browser" : true, // Web Browser (window, document, etc)
"browserify" : false, // Browserify (node.js code in the browser)
"couch" : false, // CouchDB
"devel" : true, // Development/debugging (alert, confirm, etc)
"dojo" : false, // Dojo Toolkit
"jasmine" : false, // Jasmine
"jquery" : false, // jQuery
"mocha" : true, // Mocha
"mootools" : false, // MooTools
"node" : true, // Node.js
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
"prototypejs" : false, // Prototype and Scriptaculous
"qunit" : false, // QUnit
"rhino" : false, // Rhino
"shelljs" : false, // ShellJS
"worker" : false, // Web Workers
"wsh" : false, // Windows Scripting Host
"yui" : false, // Yahoo User Interface
// Custom Globals
"globals" : {
// jasmine helpers
"expect": false,
"describe": false,
"ddescribe": false,
"beforeEach": false,
"it": false,
"iit": false
}
}

View File

@ -1,5 +1,18 @@
language: node_js language: node_js
node_js: node_js:
- "0.12" - "4"
- "0.10" - "5"
- "iojs" - "6"
env:
- WEBPACK_VERSION=1 EXTRACT_PLUGIN_VERSION=1
- WEBPACK_VERSION=2 EXTRACT_PLUGIN_VERSION=2
- WEBPACK_VERSION=3 EXTRACT_PLUGIN_VERSION=3.0.0-beta.3
before_install:
- stty columns 120
install:
- npm install --ignore-scripts
- npm rm webpack
- npm rm extract-text-webpack-plugin
- npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_PLUGIN_VERSION --ignore-scripts || true
script:
- npm test

277
CHANGELOG.md Normal file
View File

@ -0,0 +1,277 @@
Change History
==============
v2.30.1
---
* Revert part the performance optimization (#723) because of #753.
v2.30.0
---
* Add manual sort
* Performance improvements (#723)
v2.29.0
---
* Add support for Webpack 3
v2.28.0
---
* Backport 3.x void tag for plugin authors
v2.27.1
---
* Revert 2.25.0 loader resolving
v2.27.0
---
* Fix a chunksorter webpack 2 issue (#569)
* Fix template path resolving(#542)
v2.26.0
---
* Allow plugins to add attributes without values to the `<script>` and `<link>` tags
v2.25.0
---
* Clearer loader output
* Add basic support for webpack 2
v2.24.1
---
* Hide event deprecated warning of 'applyPluginsAsyncWaterfall' for html-webpack-plugin-after-emit and improve the warning message.
v2.24.0
---
* Update dependencies
* Add deprecate warning for plugins not returning a result
* Add [path] for favicons
v2.23.0
---
* Update dependencies
* Stop automated tests for webpack 2 beta because of #401
v2.22.0
---
* Update dependencies
v2.21.1
---
* Better error handling (#354)
v2.21.0
----
* Add `html-webpack-plugin-alter-asset-tags` event to allow plugins to adjust the script/link tags
v2.20.0
----
* Exclude chunks works now even if combined with dependency sort
v2.19.0
----
* Add `html-webpack-plugin-alter-chunks` event for custom chunk sorting and interpolation
v2.18.0
----
* Updated all dependencies
v2.17.0
----
* Add `type` attribute to `script` element to prevent issues in Safari 9.1.1
v2.16.2
----
* Fix bug introduced by 2.16.2. Fixes #315
v2.16.1
----
* Fix hot module replacement for webpack 2.x
v2.16.0
----
* Add support for dynamic filenames like index[hash].html
v2.15.0
----
* Add full unit test coverage for the webpack 2 beta version
* For webpack 2 the default sort will be 'dependency' instead of 'id'
* Upgrade dependencies
v2.14.0
----
* Export publicPath to the template
* Add example for inlining css and js
v2.13.0
----
* Add support for absolute output file names
* Add support for relative file names outside the output path
v2.12.0
----
* Basic Webpack 2.x support #225
v2.11.0
----
* Add `xhtml` option which is turned of by default. When activated it will inject self closed `<link href=".." />` tags instead of unclosed `<link href="..">` tags. https://github.com/ampedandwired/html-webpack-plugin/pull/255
* Add support for webpack placeholders inside the public path e.g. `'/dist/[hash]/'`. https://github.com/ampedandwired/html-webpack-plugin/pull/249
v2.10.0
----
* Add `hash` field to the chunk object
* Add `compilation` field to the templateParam object (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/237)
* Add `html-webpack-plugin-before-html-generation` event
* Improve error messages
v2.9.0
----
* Fix favicon path (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/185, https://github.com/ampedandwired/html-webpack-plugin/issues/208, https://github.com/ampedandwired/html-webpack-plugin/pull/215 )
v2.8.2
----
* Support relative URLs on Windows (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/205 )
v2.8.1
----
* Caching improvements (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/204 )
v2.8.0
----
* Add `dependency` mode for `chunksSortMode` to sort chunks based on their dependencies with each other
v2.7.2
----
* Add support for require in js templates
v2.7.1
----
* Refactoring
* Fix relative windows path
v2.6.5
----
* Minor refactoring
v2.6.4
----
* Fix for `"Uncaught TypeError: __webpack_require__(...) is not a function"`
* Fix incomplete cache modules causing "HtmlWebpackPlugin Error: No source available"
* Fix some issues on Windows
v2.6.3
----
* Prevent parsing the base template with the html-loader
v2.6.2
----
* Fix `lodash` resolve error (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/172 )
v2.6.1
----
* Fix missing module (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/164 )
v2.6.0
----
* Move compiler to its own file
* Improve error messages
* Fix global HTML_WEBPACK_PLUGIN variable
v2.5.0
----
* Support `lodash` template's HTML _"escape"_ delimiter (`<%- %>`)
* Fix bluebird warning (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/130 )
* Fix an issue where incomplete cache modules were used
v2.4.0
----
* Don't recompile if the assets didn't change
v2.3.0
----
* Add events `html-webpack-plugin-before-html-processing`, `html-webpack-plugin-after-html-processing`, `html-webpack-plugin-after-emit` to allow other plugins to alter the html this plugin executes
v2.2.0
----
* Inject css and js even if the html file is incomplete (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/135 )
* Update dependencies
v2.1.0
----
* Synchronize with the stable `@1` version
v2.0.4
----
* Fix `minify` option
* Fix missing hash interpolation in publicPath
v2.0.3
----
* Add support for webpack.BannerPlugin
v2.0.2
----
* Add support for loaders in templates (fixes https://github.com/ampedandwired/html-webpack-plugin/pull/41 )
* Remove `templateContent` option from configuration
* Better error messages
* Update dependencies
v1.7.0
----
* Add `chunksSortMode` option to configuration to control how chunks should be sorted before they are included to the html
* Don't insert async chunks into html (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/95 )
* Update dependencies
v1.6.2
----
* Fix paths on Windows
* Fix missing hash interpolation in publicPath
* Allow only `false` or `object` in `minify` configuration option
v1.6.1
----
* Add `size` field to the chunk object
* Fix stylesheet `<link>`s being discarded when used with `"inject: 'head'"`
* Update dependencies
v1.6.0
----
* Support placing templates in subfolders
* Don't include chunks with undefined name (fixes https://github.com/ampedandwired/html-webpack-plugin/pull/60 )
* Don't include async chunks
v1.5.2
----
* Update dependencies (lodash)
v1.5.1
----
* Fix error when manifest is specified (fixes https://github.com/ampedandwired/html-webpack-plugin/issues/56 )
v1.5.0
----
* Allow to inject javascript files into the head of the html page
* Fix error reporting
v1.4.0
----
* Add `favicon.ico` option
* Add html minifcation
v1.2.0
------
* Set charset using HTML5 meta attribute
* Reload upon change when using webpack watch mode
* Generate manifest attribute when using
[appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)
* Optionally add webpack hash as a query string to resources included in the HTML
(`hash: true`) for cache busting
* CSS files generated using webpack (for example, by using the
[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))
are now automatically included into the generated HTML
* More detailed information about the files generated by webpack is now available
to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more
details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.
* The `templateContent` option can now be a function that returns the template string to use
* Expose webpack configuration to templates (`o.webpackConfig`)
* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).

View File

@ -1,25 +0,0 @@
Change History
==============
v1.4.0
----
* Add `favicon.ico` option
* Add html minifcation
v1.2.0
------
* Set charset using HTML5 meta attribute
* Reload upon change when using webpack watch mode
* Generate manifest attribute when using
[appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin)
* Optionally add webpack hash as a query string to resources included in the HTML
(`hash: true`) for cache busting
* CSS files generated using webpack (for example, by using the
[extract-text-webpack-plugin](https://github.com/webpack/extract-text-webpack-plugin))
are now automatically included into the generated HTML
* More detailed information about the files generated by webpack is now available
to templates in the `o.htmlWebpackPlugin.files` attribute. See readme for more
details. This new attribute deprecates the old `o.htmlWebpackPlugin.assets` attribute.
* The `templateContent` option can now be a function that returns the template string to use
* Expose webpack configuration to templates (`o.webpackConfig`)
* Sort chunks to honour dependencies between them (useful for use with CommonsChunkPlugin).

177
README.md
View File

@ -1,19 +1,44 @@
HTML Webpack Plugin HTML Webpack Plugin
=================== ===================
[![npm version](https://badge.fury.io/js/html-webpack-plugin.svg)](http://badge.fury.io/js/html-webpack-plugin) [![Dependency Status](https://david-dm.org/ampedandwired/html-webpack-plugin.svg)](https://david-dm.org/ampedandwired/html-webpack-plugin) [![bitHound Score](https://www.bithound.io/github/ampedandwired/html-webpack-plugin/badges/score.svg)](https://www.bithound.io/github/ampedandwired/html-webpack-plugin) [![Build status](https://travis-ci.org/ampedandwired/html-webpack-plugin.svg)](https://travis-ci.org/ampedandwired/html-webpack-plugin) [![npm version](https://badge.fury.io/js/html-webpack-plugin.svg)](http://badge.fury.io/js/html-webpack-plugin) [![Dependency Status](https://david-dm.org/jantimon/html-webpack-plugin.svg)](https://david-dm.org/jantimon/html-webpack-plugin) [![Build status](https://travis-ci.org/jantimon/html-webpack-plugin.svg)](https://travis-ci.org/jantimon/html-webpack-plugin) [![Windows build status](https://ci.appveyor.com/api/projects/status/github/jantimon/html-webpack-plugin?svg=true&branch=master)](https://ci.appveyor.com/project/jantimon/html-webpack-plugin) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard) [![bitHound Dependencies](https://www.bithound.io/github/jantimon/html-webpack-plugin/badges/dependencies.svg)](https://www.bithound.io/github/jantimon/html-webpack-plugin/master/dependencies/npm) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)]()
[![NPM](https://nodei.co/npm/html-webpack-plugin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/html-webpack-plugin/)
This is a [webpack](http://webpack.github.io/) plugin that simplifies creation of HTML files to serve your This is a [webpack](http://webpack.github.io/) plugin that simplifies creation of HTML files to serve your
webpack bundles. This is especially useful for webpack bundles that include webpack bundles. This is especially useful for webpack bundles that include
a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply a hash in the filename which changes every compilation. You can either let the plugin generate an HTML file for you, supply
your own template using lodash templates or use your own loader. your own template using lodash templates or use your own loader.
Maintainer: Jan Nicklas [@jantimon](https://twitter.com/jantimon) and Thomas Sileghem [@mastilver](https://twitter.com/mastilver)
Installation Installation
------------ ------------
Install the plugin with npm: Install the plugin with npm:
```shell ```shell
$ npm install html-webpack-plugin@2 --save-dev $ npm install html-webpack-plugin --save-dev
``` ```
Third party addons:
-------------
The html-webpack-plugin provides [hooks](https://github.com/jantimon/html-webpack-plugin#events) to extend it to your needs.
There are already some really powerful plugins which can be integrated with zero configuration:
* [webpack-subresource-integrity](https://www.npmjs.com/package/webpack-subresource-integrity) for enhanced asset security
* [appcache-webpack-plugin](https://github.com/lettertwo/appcache-webpack-plugin) for iOS and Android offline usage
* [favicons-webpack-plugin](https://github.com/jantimon/favicons-webpack-plugin) which generates favicons and icons for iOS, Android and desktop browsers
* [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin) can be used to always write to disk the html file, useful when webpack-dev-server / HMR are being used
* [html-webpack-inline-source-plugin](https://github.com/DustinJackson/html-webpack-inline-source-plugin) to inline your assets in the resulting HTML file
* [html-webpack-inline-svg-plugin](https://github.com/thegc/html-webpack-inline-svg-plugin) to inline SVGs in the resulting HTML file.
* [html-webpack-exclude-assets-plugin](https://github.com/jamesjieye/html-webpack-exclude-assets-plugin) for excluding assets using regular expressions
* [html-webpack-include-assets-plugin](https://github.com/jharris4/html-webpack-include-assets-plugin) for including lists of js or css file paths (such as those copied by the copy-webpack-plugin).
* [script-ext-html-webpack-plugin](https://github.com/numical/script-ext-html-webpack-plugin) to add `async`, `defer` or `module` attributes to your`<script>` elements, or even in-line them
* [style-ext-html-webpack-plugin](https://github.com/numical/style-ext-html-webpack-plugin) to convert your `<link>`s to external stylesheets into `<style>` elements containing internal CSS
* [resource-hints-webpack-plugin](https://github.com/jantimon/resource-hints-webpack-plugin) to add resource hints for faster initial page loads using `<link rel='preload'>` and `<link rel='prefetch'>`
* [preload-webpack-plugin](https://github.com/GoogleChrome/preload-webpack-plugin) for automatically wiring up asynchronous (and other types) of JavaScript chunks using `<link rel='preload'>` helping with lazy-loading
* [link-media-html-webpack-plugin](https://github.com/yaycmyk/link-media-html-webpack-plugin) allows for injected stylesheet `<link />` tags to have their media attribute set automatically; useful for providing specific desktop/mobile/print etc. stylesheets that the browser will conditionally download
* [inline-chunk-manifest-html-webpack-plugin](https://github.com/jouni-kantola/inline-chunk-manifest-html-webpack-plugin) for inlining webpack's chunk manifest. Default extracts manifest and inlines in `<head>`.
Basic Usage Basic Usage
----------- -----------
@ -22,15 +47,15 @@ bundles in the body using `script` tags. Just add the plugin to your webpack
config as follows: config as follows:
```javascript ```javascript
var HtmlWebpackPlugin = require('html-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpackConfig = { var webpackConfig = {
entry: 'index.js', entry: 'index.js',
output: { output: {
path: 'dist', path: __dirname + '/dist',
filename: 'index_bundle.js' filename: 'index_bundle.js'
}, },
plugins: [new HtmlWebpackPlugin()] plugins: [new HtmlWebpackPlugin()]
} };
``` ```
This will generate a file `dist/index.html` containing the following: This will generate a file `dist/index.html` containing the following:
@ -50,7 +75,7 @@ This will generate a file `dist/index.html` containing the following:
If you have multiple webpack entry points, they will all be included with `script` If you have multiple webpack entry points, they will all be included with `script`
tags in the generated HTML. tags in the generated HTML.
If you have any css assets in webpack's output (for example, css extracted If you have any CSS assets in webpack's output (for example, CSS extracted
with the [ExtractTextPlugin](https://github.com/webpack/extract-text-webpack-plugin)) with the [ExtractTextPlugin](https://github.com/webpack/extract-text-webpack-plugin))
then these will be included with `<link>` tags in the HTML head. then these will be included with `<link>` tags in the HTML head.
@ -62,26 +87,26 @@ Allowed values are as follows:
- `title`: The title to use for the generated HTML document. - `title`: The title to use for the generated HTML document.
- `filename`: The file to write the HTML to. Defaults to `index.html`. - `filename`: The file to write the HTML to. Defaults to `index.html`.
You can specify a subdirectory here too (eg: `assets/admin.html`). You can specify a subdirectory here too (eg: `assets/admin.html`).
- `template`: Path to the template. Supports loaders e.g. `html!./index.html`. - `template`: Webpack require path to the template. Please see the [docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md) for details.
- `inject`: `true | 'head' | 'body' | false` Inject all assets into the given `template` or `templateContent` - When passing `true` or `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. - `inject`: `true | 'head' | 'body' | false` Inject all assets into the given `template` or `templateContent` - When passing `true` or `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element.
- `favicon`: Adds the given favicon path to the output html. - `favicon`: Adds the given favicon path to the output html.
- `minify`: `{...} | false` Pass a [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference) options object to minify the output. - `minify`: `{...} | false` Pass [html-minifier](https://github.com/kangax/html-minifier#options-quick-reference)'s options as object to minify the output.
- `hash`: `true | false` if `true` then append a unique webpack compilation hash to all - `hash`: `true | false` if `true` then append a unique webpack compilation hash to all
included scripts and css files. This is useful for cache busting. included scripts and CSS files. This is useful for cache busting.
- `cache`: `true | false` if `true` (default) try to emit the file only if it was changed. - `cache`: `true | false` if `true` (default) try to emit the file only if it was changed.
- `showErrors`: `true | false` if `true` (default) errors details will be written into the html page. - `showErrors`: `true | false` if `true` (default) errors details will be written into the HTML page.
- `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk) - `chunks`: Allows you to add only some chunks (e.g. only the unit-test chunk)
- `chunksSortMode`: Allows to controll how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'default' | {function} - default: 'auto' - `chunksSortMode`: Allows to control how chunks should be sorted before they are included to the html. Allowed values: 'none' | 'auto' | 'dependency' |'manual' | {function} - default: 'auto'
- `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk) - `excludeChunks`: Allows you to skip some chunks (e.g. don't add the unit-test chunk)
- `xhtml`: `true | false` If `true` render the `link` tags as self-closing, XHTML compliant. Default is `false`
Here's an example webpack config illustrating how to use these options: Here's an example webpack config illustrating how to use these options:
```javascript ```javascript
{ {
entry: 'index.js', entry: 'index.js',
output: { output: {
path: 'dist', path: __dirname + '/dist',
filename: 'index_bundle.js', filename: 'index_bundle.js'
hash: true
}, },
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
@ -92,6 +117,13 @@ Here's an example webpack config illustrating how to use these options:
} }
``` ```
FAQ
----
* [Why is my HTML minified?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
* [Why is my `<% ... %>` template not working?](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
* [How can I use handlebars/pug/ejs as template engine](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md)
Generating Multiple HTML Files Generating Multiple HTML Files
------------------------------ ------------------------------
To generate more than one HTML file, declare the plugin more than To generate more than one HTML file, declare the plugin more than
@ -100,7 +132,7 @@ once in your plugins array:
{ {
entry: 'index.js', entry: 'index.js',
output: { output: {
path: 'dist', path: __dirname + '/dist',
filename: 'index_bundle.js' filename: 'index_bundle.js'
}, },
plugins: [ plugins: [
@ -116,21 +148,20 @@ once in your plugins array:
Writing Your Own Templates Writing Your Own Templates
-------------------------- --------------------------
If the default generated HTML doesn't meet your needs you can supply If the default generated HTML doesn't meet your needs you can supply
your own template. The easiest way is to use the `inject` option and pass a custom html file. your own template. The easiest way is to use the `template` option and pass a custom HTML file.
The html-webpack-plugin will automatically inject all necessary css, js, manifest The html-webpack-plugin will automatically inject all necessary CSS, JS, manifest
and favicon files into the markup. and favicon files into the markup.
```javascript ```javascript
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
title: 'Custom template', title: 'Custom template',
template: 'my-index.html', // Load a custom template template: 'my-index.ejs', // Load a custom template (ejs by default see the FAQ for details)
inject: 'body' // Inject all scripts into the body
}) })
] ]
``` ```
`my-index.html`: `my-index.ejs`:
```html ```html
<!DOCTYPE html> <!DOCTYPE html>
@ -145,6 +176,7 @@ plugins: [
``` ```
If you already have a template loader, you can use it to parse the template. If you already have a template loader, you can use it to parse the template.
Please note that this will also happen if you specifiy the html-loader and use `.html` file as template.
```javascript ```javascript
module: { module: {
@ -155,55 +187,15 @@ module: {
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
title: 'Custom template using Handlebars', title: 'Custom template using Handlebars',
template: 'my-index.hbs', template: 'my-index.hbs'
inject: 'body'
})
]
```
Alternatively, if you already have your template's content in a String, you
can pass it to the plugin using the `templateContent` option:
```javascript
plugins: [
new HtmlWebpackPlugin({
inject: true,
templateContent: templateContentString
}) })
] ]
``` ```
You can use the lodash syntax out of the box. You can use the lodash syntax out of the box.
If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/ampedandwired/html-webpack-plugin/blob/feature/loaders/default_index.html) If the `inject` feature doesn't fit your needs and you want full control over the asset placement use the [default template](https://github.com/jaketrent/html-webpack-template/blob/86f285d5c790a6c15263f5cc50fd666d51f974fd/index.html) of the [html-webpack-template project](https://github.com/jaketrent/html-webpack-template) as a starting point for writing your own.
as a starting point for writing your own.
The `templateContent` option can also be a function to use another template language like jade: The following variables are available in the template:
```javascript
plugins: [
new HtmlWebpackPlugin({
templateContent: function(templateParams, compilation) {
// Return your template content synchronously here
return '..';
}
})
]
```
Or the async version:
```javascript
plugins: [
new HtmlWebpackPlugin({
templateContent: function(templateParams, compilation, callback) {
// Return your template content asynchronously here
callback(null, '..');
}
})
]
```
Note the plugin will throw an error if you specify both `template` _and_
`templateContent`.
The `o` variable in the template is the data that is passed in when the
template is rendered. This variable has the following attributes:
- `htmlWebpackPlugin`: data specific to this plugin - `htmlWebpackPlugin`: data specific to this plugin
- `htmlWebpackPlugin.files`: a massaged representation of the - `htmlWebpackPlugin.files`: a massaged representation of the
`assetsByChunkName` attribute of webpack's [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) `assetsByChunkName` attribute of webpack's [stats](https://github.com/webpack/docs/wiki/node.js-api#stats)
@ -236,7 +228,7 @@ template is rendered. This variable has the following attributes:
- `webpack`: the webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) - `webpack`: the webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats)
object. Note that this is the stats object as it was at the time the HTML template object. Note that this is the stats object as it was at the time the HTML template
was emitted and as such may not have the full set of stats that are available was emitted and as such may not have the full set of stats that are available
after the wepback run is complete. after the webpack run is complete.
- `webpackConfig`: the webpack configuration that was used for this compilation. This - `webpackConfig`: the webpack configuration that was used for this compilation. This
can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`). can be used, for example, to get the `publicPath` (`webpackConfig.output.publicPath`).
@ -268,17 +260,64 @@ plugins: [
Events Events
------ ------
To allow other plugins to alter the html this plugin executes the following events: To allow other [plugins](https://github.com/webpack/docs/wiki/plugins) to alter the HTML this plugin executes the following events:
Async:
* `html-webpack-plugin-before-html-generation`
* `html-webpack-plugin-before-html-processing` * `html-webpack-plugin-before-html-processing`
* `html-webpack-plugin-alter-asset-tags`
* `html-webpack-plugin-after-html-processing` * `html-webpack-plugin-after-html-processing`
* `html-webpack-plugin-after-emit` * `html-webpack-plugin-after-emit`
Sync:
* `html-webpack-plugin-alter-chunks`
Example implementation: [html-webpack-harddisk-plugin](https://github.com/jantimon/html-webpack-harddisk-plugin)
Usage: Usage:
``` ```javascript
compilation.plugin('html-webpack-plugin-before-html-processing', function(htmlPluginData, callback) { // MyPlugin.js
htmlPluginData.html += 'The magic footer';
callback(); function MyPlugin(options) {
// Configure your plugin with options...
}
MyPlugin.prototype.apply = function(compiler) {
// ...
compiler.plugin('compilation', function(compilation) {
console.log('The compiler is starting a new compilation...');
compilation.plugin('html-webpack-plugin-before-html-processing', function(htmlPluginData, callback) {
htmlPluginData.html += 'The magic footer';
callback(null, htmlPluginData);
});
}); });
};
module.exports = MyPlugin;
``` ```
Then in `webpack.config.js`
```javascript
plugins: [
new MyPlugin({options: ''})
]
```
Note that the callback must be passed the htmlPluginData in order to pass this onto any other plugins listening on the same `html-webpack-plugin-before-html-processing` event.
# Contribution
You're free to contribute to this project by submitting [issues](https://github.com/jantimon/html-webpack-plugin/issues) and/or [pull requests](https://github.com/jantimon/html-webpack-plugin/pulls). This project is test-driven, so keep in mind that every change and new feature should be covered by tests.
This project uses the [semistandard code style](https://github.com/Flet/semistandard).
Before running the tests, make sure to execute `yarn link` and `yarn link html-webpack-plugin` (or the npm variant of this).
# License
This project is licensed under [MIT](https://github.com/jantimon/html-webpack-plugin/blob/master/LICENSE).

23
appveyor.yml Normal file
View File

@ -0,0 +1,23 @@
# appveyor file
# http://www.appveyor.com/docs/appveyor-yml
environment:
matrix:
- nodejs_version: 0.10
- nodejs_version: 0.12
- nodejs_version: 4
version: "{build}"
build: off
deploy: off
matrix:
fast_finish: true
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm test

82
docs/template-option.md Normal file
View File

@ -0,0 +1,82 @@
# The template option
## History
The version 2.x which was introduced last year (Sep, 2015) changed the way the template is processed.
Instead of forcing all users to use the [blueimp](https://github.com/blueimp/JavaScript-Templates) template engine it allowed to use any webpack loader:
* [jade/pug](https://github.com/pugjs/pug-loader)
* [ejs](https://github.com/okonet/ejs-loader)
* [underscore](https://github.com/emaphp/underscore-template-loader)
* [handlebars](https://github.com/pcardune/handlebars-loader)
* [html-loader](https://github.com/webpack/html-loader)
* ...
Under the hood it is using a webpack child compilation which inherits all loaders from
your main configuration.
There are three ways to set the loader:
## 1) Don't set any loader
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.
```js
{
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.ejs'
})
]
}
```
It is a good idea to use `.ejs` instead of `.html` so you do not unexpectedly trigger another loader.
## 2) Setting a loader directly for the template
```js
new HtmlWebpackPlugin({
// For details on `!!` see https://webpack.github.io/docs/loaders.html#loader-order
template: '!!handlebars!src/index.hbs'
})
```
## 3) Setting a loader using the `module.loaders` syntax
```js
{
module: {
loaders: [
{
test: /\.hbs$/,
loader: 'handlebars-loader'
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.hbs'
})
]
}
```
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/).
This will **cause html minification** and it will also **disable the ejs fallback** loader.
```js
{
module: {
loaders: [
{
test: /\.html$/,
loader: 'html-loader'
}],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
}
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1 @@
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>

View File

@ -0,0 +1,9 @@
CACHE MANIFEST
# f688cbdde5a6e721015e
0714810ae3fb211173e2964249507195.png
bundle.js
styles.css
NETWORK:
*

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,86 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(0);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ })
/******/ ]);

View File

@ -0,0 +1 @@
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>

View File

@ -0,0 +1,9 @@
CACHE MANIFEST
# 737de2033617f9f6144d
0714810ae3fb211173e2964249507195.png
bundle.js
styles.css
NETWORK:
*

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,83 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1 @@
<!doctype html><html lang="en" manifest="manifest.appcache"><head><meta charset="utf-8"><title>Example template</title><meta name="viewport" content="width=device-width,initial-scale=1"><link href="styles.css" rel="stylesheet"></head><body><img src="0714810ae3fb211173e2964249507195.png"><script type="text/javascript" src="bundle.js"></script></body></html>

View File

@ -0,0 +1,9 @@
CACHE MANIFEST
# eda37a6c6de5fd0ecfbe
0714810ae3fb211173e2964249507195.png
bundle.js
styles.css
NETWORK:
*

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

4
examples/appcache/example.js Executable file
View File

@ -0,0 +1,4 @@
require('./main.css');
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);

BIN
examples/appcache/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<img src="logo.png">
</body>
</html>

View File

@ -0,0 +1,34 @@
var path = require('path');
var AppCachePlugin = require('appcache-webpack-plugin');
var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = {
context: __dirname,
entry: './example.js',
output: {
path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '',
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') },
{ test: /\.png$/, loader: 'file-loader' },
{ test: /\.html$/, loader: 'html-loader?-removeOptionalTags' }
]
},
plugins: [
new AppCachePlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'template.html',
minify: {
removeComments: true,
collapseWhitespace: true
}
}),
new ExtractTextPlugin('styles.css')
]
};

View File

@ -0,0 +1,53 @@
/**
* This file is just a helper to compile all examples.
*
* You could do the same by going into each example and execute
* `webpack`
*/
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
var fs = require('fs');
var path = require('path');
var rimraf = require('rimraf');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
if (Number(webpackMajorVersion) > 1) {
var extractOriginal = ExtractTextPlugin.extract;
ExtractTextPlugin.extract = function (fallback, use) {
return extractOriginal({
fallback: fallback,
use: use
});
};
}
var examples = fs.readdirSync(__dirname).filter(function (file) {
return fs.statSync(path.join(__dirname, file)).isDirectory();
});
examples.forEach(function (exampleName) {
var examplePath = path.join(__dirname, exampleName);
var configFile = path.join(examplePath, 'webpack.config.js');
rimraf.sync(path.join(examplePath, 'dist', 'webpack-' + webpackMajorVersion));
webpack(require(configFile), function (err, stats) {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
const info = stats.toJson();
if (stats.hasErrors()) {
console.error(info.errors);
}
if (stats.hasWarnings()) {
console.warn(info.warnings);
}
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Webpack App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles.css" rel="stylesheet"></head>
<body>
<h2>Partial</h2>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,86 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(0);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ })
/******/ ]);

View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Webpack App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles.css" rel="stylesheet"></head>
<body>
<h2>Partial</h2>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,83 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Webpack App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="styles.css" rel="stylesheet"></head>
<body>
<h2>Partial</h2>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -1,4 +1,4 @@
require('./main.css'); require('./main.css');
var h1 = document.createElement('h1'); var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!'; h1.innerHTML = 'Hello world!';
document.body.appendChild(h1); document.body.appendChild(h1);

View File

@ -6,6 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
<body> <body>
<%= require('html!./partial.html') %> <%= require('html-loader!./partial.html') %>
</body> </body>
</html> </html>

View File

@ -1,9 +1,13 @@
var path = require('path');
var HtmlWebpackPlugin = require('../..'); var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = { module.exports = {
context: __dirname,
entry: './example.js', entry: './example.js',
output: { output: {
path: __dirname + '/dist', path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '', publicPath: '',
filename: 'bundle.js' filename: 'bundle.js'
}, },
@ -19,4 +23,4 @@ module.exports = {
}), }),
new ExtractTextPlugin('styles.css') new ExtractTextPlugin('styles.css')
] ]
}; };

View File

@ -0,0 +1,402 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(2);
if(typeof content === 'string') content = [[module.id, content, '']];
// add the styles to the DOM
var update = __webpack_require__(4)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../node_modules/css-loader/index.js!./main.css", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!./main.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(3)();
// imports
// module
exports.push([module.id, "body {\n background: snow;\n}", ""]);
// exports
/***/ }),
/* 3 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
var result = [];
for(var i = 0; i < this.length; i++) {
var item = this[i];
if(item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(false) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
</head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,428 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(2);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(4)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../node_modules/css-loader/index.js!./main.css", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!./main.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(0);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(3)();
// imports
// module
exports.push([module.i, "body {\n background: snow;\n}", ""]);
// exports
/***/ }),
/* 3 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
var result = [];
for(var i = 0; i < this.length; i++) {
var item = this[i];
if(item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
/***/ }),
/* 4 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(typeof DEBUG !== "undefined" && DEBUG) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
</head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,425 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(2);
if(typeof content === 'string') content = [[module.i, content, '']];
// add the styles to the DOM
var update = __webpack_require__(4)(content, {});
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../node_modules/css-loader/index.js!./main.css", function() {
var newContent = require("!!../../node_modules/css-loader/index.js!./main.css");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(3)();
// imports
// module
exports.push([module.i, "body {\n background: snow;\n}", ""]);
// exports
/***/ }),
/* 3 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
var result = [];
for(var i = 0; i < this.length; i++) {
var item = this[i];
if(item[2]) {
result.push("@media " + item[2] + "{" + item[1] + "}");
} else {
result.push(item[1]);
}
}
return result.join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
/***/ }),
/* 4 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {},
memoize = function(fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
},
isOldIE = memoize(function() {
return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
}),
getHeadElement = memoize(function () {
return document.head || document.getElementsByTagName("head")[0];
}),
singletonElement = null,
singletonCounter = 0,
styleElementsInsertedAtTop = [];
module.exports = function(list, options) {
if(typeof DEBUG !== "undefined" && DEBUG) {
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (typeof options.singleton === "undefined") options.singleton = isOldIE();
// By default, add <style> tags to the bottom of <head>.
if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
var styles = listToStyles(list);
addStylesToDom(styles, options);
return function update(newList) {
var mayRemove = [];
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList);
addStylesToDom(newStyles, options);
}
for(var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for(var j = 0; j < domStyle.parts.length; j++)
domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
}
function addStylesToDom(styles, options) {
for(var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles(list) {
var styles = [];
var newStyles = {};
for(var i = 0; i < list.length; i++) {
var item = list[i];
var id = item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id])
styles.push(newStyles[id] = {id: id, parts: [part]});
else
newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement(options, styleElement) {
var head = getHeadElement();
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if(!lastStyleElementInsertedAtTop) {
head.insertBefore(styleElement, head.firstChild);
} else if(lastStyleElementInsertedAtTop.nextSibling) {
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
} else {
head.appendChild(styleElement);
}
styleElementsInsertedAtTop.push(styleElement);
} else if (options.insertAt === "bottom") {
head.appendChild(styleElement);
} else {
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
}
}
function removeStyleElement(styleElement) {
styleElement.parentNode.removeChild(styleElement);
var idx = styleElementsInsertedAtTop.indexOf(styleElement);
if(idx >= 0) {
styleElementsInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement(options) {
var styleElement = document.createElement("style");
styleElement.type = "text/css";
insertStyleElement(options, styleElement);
return styleElement;
}
function createLinkElement(options) {
var linkElement = document.createElement("link");
linkElement.rel = "stylesheet";
insertStyleElement(options, linkElement);
return linkElement;
}
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
styleElement = singletonElement || (singletonElement = createStyleElement(options));
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
} else if(obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function") {
styleElement = createLinkElement(options);
update = updateLink.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
if(styleElement.href)
URL.revokeObjectURL(styleElement.href);
};
} else {
styleElement = createStyleElement(options);
update = applyToTag.bind(null, styleElement);
remove = function() {
removeStyleElement(styleElement);
};
}
update(obj);
return function updateStyle(newObj) {
if(newObj) {
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
return;
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag(styleElement, index, remove, obj) {
var css = remove ? "" : obj.css;
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = styleElement.childNodes;
if (childNodes[index]) styleElement.removeChild(childNodes[index]);
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index]);
} else {
styleElement.appendChild(cssNode);
}
}
}
function applyToTag(styleElement, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
styleElement.setAttribute("media", media)
}
if(styleElement.styleSheet) {
styleElement.styleSheet.cssText = css;
} else {
while(styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild);
}
styleElement.appendChild(document.createTextNode(css));
}
}
function updateLink(linkElement, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
if(sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = linkElement.href;
linkElement.href = URL.createObjectURL(blob);
if(oldSrc)
URL.revokeObjectURL(oldSrc);
}
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
</head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -1,4 +1,4 @@
require('./main.css'); require('./main.css');
var h1 = document.createElement('h1'); var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!'; h1.innerHTML = 'Hello world!';
document.body.appendChild(h1); document.body.appendChild(h1);

View File

@ -1,8 +1,11 @@
var HtmlWebpackPlugin = require('..'); var path = require('path');
var HtmlWebpackPlugin = require('../..');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = { module.exports = {
context: __dirname,
entry: './example.js', entry: './example.js',
output: { output: {
path: __dirname + '/dist', path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '', publicPath: '',
filename: 'bundle.js' filename: 'bundle.js'
}, },
@ -15,4 +18,4 @@ module.exports = {
plugins: [ plugins: [
new HtmlWebpackPlugin() new HtmlWebpackPlugin()
] ]
}; };

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HtmlWebpackPlugin example</title>
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,86 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(0);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HtmlWebpackPlugin example</title>
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,83 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HtmlWebpackPlugin example</title>
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -1,4 +1,4 @@
require('./main.css'); require('./main.css');
var h1 = document.createElement('h1'); var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!'; h1.innerHTML = 'Hello world!';
document.body.appendChild(h1); document.body.appendChild(h1);

View File

@ -1,9 +1,12 @@
var HtmlWebpackPlugin = require('..'); var path = require('path');
var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = { module.exports = {
context: __dirname,
entry: './example.js', entry: './example.js',
output: { output: {
path: __dirname + '/dist', path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '', publicPath: '',
filename: 'bundle.js' filename: 'bundle.js'
}, },
@ -21,4 +24,4 @@ module.exports = {
}), }),
new ExtractTextPlugin('styles.css') new ExtractTextPlugin('styles.css')
] ]
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,86 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(0);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,83 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!';
document.body.appendChild(h1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example template</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico"><link href="styles.css" rel="stylesheet"></head>
<body>
<img src="0714810ae3fb211173e2964249507195.png">
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -1,4 +1,4 @@
require('./main.css'); require('./main.css');
var h1 = document.createElement('h1'); var h1 = document.createElement('h1');
h1.innerHTML = 'Hello world!'; h1.innerHTML = 'Hello world!';
document.body.appendChild(h1); document.body.appendChild(h1);

View File

@ -1,9 +1,12 @@
var path = require('path');
var HtmlWebpackPlugin = require('../..'); var HtmlWebpackPlugin = require('../..');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpackMajorVersion = require('webpack/package.json').version.split('.')[0];
module.exports = { module.exports = {
context: __dirname,
entry: './example.js', entry: './example.js',
output: { output: {
path: __dirname + '/dist', path: path.join(__dirname, 'dist/webpack-' + webpackMajorVersion),
publicPath: '', publicPath: '',
filename: 'bundle.js' filename: 'bundle.js'
}, },
@ -11,7 +14,7 @@ module.exports = {
loaders: [ loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') },
{ test: /\.png$/, loader: 'file-loader' }, { test: /\.png$/, loader: 'file-loader' },
{ test: /\.html$/, loader: 'html-loader' }, { test: /\.html$/, loader: 'html-loader' }
] ]
}, },
plugins: [ plugins: [
@ -27,4 +30,4 @@ module.exports = {
}), }),
new ExtractTextPlugin('styles.css') new ExtractTextPlugin('styles.css')
] ]
}; };

View File

@ -0,0 +1,60 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(1);
console.log('Hello World');
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,62 @@
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>Jade demo</title></head><body><style>body {
background: snow;
}</style><script type="text/javascript">/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(1);
console.log('Hello World');
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);</script></body></html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,87 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(0);
console.log('Hello World');
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,89 @@
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>Jade demo</title></head><body><style>body {
background: snow;
}</style><script type="text/javascript">/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(0);
console.log('Hello World');
/***/ })
/******/ ]);</script></body></html>

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,84 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(1);
console.log('Hello World');
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@ -0,0 +1,86 @@
<!DOCTYPE html><html><head><meta http-equiv="Content-type" content="text/html; charset=utf-8"><title>Jade demo</title></head><body><style>body {
background: snow;
}</style><script type="text/javascript">/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(1);
console.log('Hello World');
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);</script></body></html>

Some files were not shown because too many files have changed in this diff Show More