Commit Graph

60 Commits

Author SHA1 Message Date
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
Oleksandr Khomenko 396cdedf8a Wrapped with path.join to fix test on io.js 2015-09-14 17:18:38 -05:00
Oleksandr Khomenko 517dfbac32 Use path.normalize instead of path.join 2015-09-14 17:09:57 -05:00
Oleksandr Khomenko 4809fa5804 Fixed 2 tests on windows.
Resolve web urls properly with node url module
2015-09-14 17:01:04 -05:00
Simen Bekkhus 909b811d70 Passing true to minify does nothing
All `html-minifier` options are `false` by default, so passing just true does nothing to the output
2015-08-14 08:59:43 +02:00
Tom Robinson 562acca036 Fixes stylesheet <links> being discarded when used with "inject: 'head'". 2015-07-29 11:23:10 -07:00
Julien Renaux dfb4f57179 Adding the file size to the chunk object
As far as I know, getting the file size within the template is not possible.

The file size is important in my case in order to have a progress loader via http request so I can do somehting like that:

```
function ajax(url, onProgress, callback, data, x) {
            try {
                x = new(this.XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
                x.open(data ? 'POST' : 'GET', url, 1);
                x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
                x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
                x.onreadystatechange = function() {
                    x.readyState > 3 && callback && callback(x.responseText, x);
                };
                x.addEventListener("progress", onProgress, false);
                x.send(data)
            } catch (e) {
                window.console && console.log(e);
            }
        };

        function onLoad(responseText) {
            var script = document.createElement('script');
            script.setAttribute('type', 'text/javascript');
            if (script.text) {
                script.text = content; // IE
            } else {
                script.appendChild(document.createTextNode(responseText));
            }
            document.getElementsByTagName('head')[0].appendChild(script);
            document.getElementById('appLoader').className = 'finished';
        }

        function onProgress(e) {
            var progress = Math.floor((e.loaded / {%=o.htmlWebpackPlugin.files.chunks.main.size %} || 0) * 100);
            document.getElementById('appLoader').setAttribute("value", progress);
            document.getElementById('appLoaderPercent').innerText = document.createTextNode(progress).textContent;
        }

        ajax('./{%=o.htmlWebpackPlugin.files.chunks.main.entry %}', onProgress, onLoad);
```
2015-07-13 11:43:18 +02:00
Jan Nicklas c630d339c6 Bump version 2015-07-08 11:27:09 +02:00
Jan Nicklas 55b530ba3f Support placing templates in subfolders 2015-06-29 15:57:18 +02:00
Olivier Tassinari 0d727cc23e [async] make sure the async chunks aren't included in the html 2015-06-15 20:30:42 +01:00
Chip Lay f5842d609e Better <html> regex for minified html strings 2015-06-10 10:06:43 -04:00
Chip Lay 82ef236cb1 Fix existing manifest regex test 2015-06-10 09:27:38 -04:00
Jan Nicklas 73a61a94e9 More verbose warning 2015-06-09 09:42:20 +02:00
Jan Nicklas 6219714fc7 Allow to inject javascript files into the head of the html page 2015-06-01 11:19:45 +02:00
Chris e5a210c60d Change assets deprecation from error to warning 2015-05-26 13:07:30 +01:00
Chris 8646d911d0 Fixes error reporting
Fixes error reporting so that instead of:

Error in undefined

We get:

Error in HtmlWebPackPlugin: htmlWebpackPlugin.assets is deprecated - please use htmlWebpackPlugin.files instead
2015-05-21 17:35:37 +01:00
Jan Nicklas ae6cfdb090 Merge pull request #43 from kennyt/patch-2
Fix typo in index.js
2015-05-19 21:47:30 +02:00
Kenny Tran d861441014 Update index.js 2015-05-19 08:04:02 -07:00
Kenny Tran 64752a6b5e Update index.js 2015-05-19 08:03:14 -07:00
Jan Nicklas ce279debd5 Deprecate htmlWebpackPlugin.assets 2015-05-17 20:02:57 +02:00
Jan Nicklas 5043ac0712 Update documentation 2015-05-12 22:58:43 +02:00
Sebastien Barre 8b97335192 Add support for minification using html-minifier 2015-05-12 22:56:51 +02:00
Jan Nicklas 26b9f28937 Add promises - add test for missing favicon 2015-05-12 22:55:06 +02:00
Jan Nicklas 80d141d8c2 Refactor favicon 2015-05-11 23:29:11 +02:00
Simen Bekkhus 5771dac3c9 Add support for favicon and apple-touch-icon
Fixes #28
2015-05-11 08:27:19 +02:00
Jan Nicklas f8eab624f4 Fix typo and manifest hash 2015-04-21 17:48:45 +02:00
Jan Nicklas 4060a42bfb Revert rebase conflict 2015-04-21 17:37:08 +02:00
Jan Nicklas fd44794a5c Cleaner chunks api 2015-04-21 17:37:08 +02:00
Jan Nicklas c060085ae4 Move the querystring to the files array 2015-04-21 17:37:08 +02:00
Jan Nicklas 932d295d1c Don't inject a hash by default 2015-04-21 17:37:08 +02:00
Jan Nicklas 383dcd480f Rename `append` to `inject` and prevent double injection 2015-04-21 17:37:08 +02:00
Jan Nicklas 76d45eda48 Add append option 2015-04-21 17:37:08 +02:00
Nikolay Artamonov e631065df8 Fixed gathering CSS chunks with content hash in their names 2015-04-21 17:37:08 +02:00
Charles Blaxland 6a9d902950 Include hash in URL within 'files' object rather than append in the template 2015-04-20 12:57:49 +10:00
Charles Blaxland cadad66359 Order chunks to reflect their dependencies 2015-04-20 12:43:46 +10:00
Charles Blaxland 6ae0e85202 Expose webpack configuration to templates 2015-03-30 12:19:10 +11:00
Charles Blaxland 4d74f4b061 Merge branch 'feature/template-function' of https://github.com/jantimon/html-webpack-plugin into jantimon-feature/template-function
Conflicts:
	index.js
2015-03-30 12:09:09 +11:00
Jan Nicklas 442f016683 Don't append a hash by default 2015-03-27 19:47:34 +01:00
Jan Nicklas 1427d4e3d7 Add .jshintrc file 2015-03-27 19:39:02 +01:00
Jan Nicklas 2815661681 Allow to pass a function for custom html rendering / templating 2015-03-13 18:21:28 +01:00
Jan Nicklas 55f316d396 Rename the assets template to support old templates files 2015-03-11 11:36:55 +01:00
Jan Nicklas 19aef72570 Catch template errors 2015-03-11 11:23:52 +01:00
Jan Nicklas c082bb8ccc Allow filter methods in jshint 2015-03-11 10:54:20 +01:00
Jan Nicklas 3947d27cf2 Use the webpack hash for automated cache busting 2015-03-11 10:50:01 +01:00
Jan Nicklas f88225fe3e Refactor asset helper to support .css (extract-text-webpack-plugin) and .manifest (appcache-webpack-plugin) files
Unfortunately this breaks the old template structure
2015-03-11 10:48:52 +01:00
Jan Nicklas 5693285436 Fix variable name - Rename compiler to compilation 2015-03-11 09:32:21 +01:00
Kurt Harriger b8df1589c5 Recompile if file has changed
Instruct webpack to watch and recompile when template file has changed.

Fixes #5
2015-01-11 18:24:11 -07:00
Charles Blaxland 58d173c3d0 Raise an error if both template and templateContent options are used together 2014-08-14 21:29:46 +10:00
Charles Blaxland 0f15aee3e2 Allow template to be specified as a string 2014-08-14 21:18:58 +10:00
Charles Blaxland 14b1a38dfa Read template file asynchronously 2014-08-14 20:36:15 +10:00