Commit graph

16 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
789ef8c639
Add support for minification of final output
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar.

This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON.

To enable, run Hugo with the `--minify` flag:

```bash
hugo --minify
```

This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain.

Fixes #1251
2018-08-06 19:58:41 +02:00
Jorin Vogel
81c13171a9 Add some missing doc comments
As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
2017-08-03 15:57:51 +02:00
Bjørn Erik Pedersen
93ca7c9e95 all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
2017-02-17 17:15:26 +01:00
Dragos Plesca
7e08d23eeb transform: Explicitly bind LiveReload to server port
If hugo server is run on port 80 or 443, LiveReload does not
correctly bind to the same port, instead using port 35729.
This commit adds functionality to inform LiveReload of the
correct port to bind to.

See https://github.com/livereload/livereload-js/issues/16

Partially contributed by Jeff Minard (@chuyskywalker).

Fixes #2205
2016-06-30 16:47:56 -06:00
Bjørn Erik Pedersen
08b582e187 Only do one livereload replacement 2016-02-06 19:22:12 +01:00
Bjørn Erik Pedersen
dd1db334ac transform: Add missing test case in livereloadinject
* Test for both </body> and </BODY>
* This also cosmetically changes the behaviour, as the case of the end body tag is kept.
2016-02-06 18:28:26 +01:00
Anthony Fok
8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Kato Kazuyoshi
ef4dfcec6c Load livereload.js from "/"
Fix #1406
Instead of loading the file from http://localhost:port/, it can be
loaded from /.
2015-10-15 16:36:13 -04:00
bep
be1287fba0 Add data-no-instant to livereload script tag
To support instantclick.

Fixes #1135
2015-05-12 19:49:46 +02:00
bep
66cf3bdc77 Rename interface contentRewriter to contentTransformer
Is is a much better name.
2015-03-19 02:07:57 +01:00
bep
e7099cfa26 Un-export ContentReWriter 2015-03-18 17:33:12 +01:00
bep
98ee69bce2 Write to rotating ContentReWriter in transformer chain
This commit adds the interface ContentReWriter in the tranformer chain.

This is backed by two pooled byte buffers, alternating between being the reader or the writer.

This keeps the performance characteristic of the old implementation, but in a thread safe way.

Fixes #911

Benchmark old vs new:

benchmark              old ns/op     new ns/op     delta
BenchmarkAbsURL        17614         17384         -1.31%
BenchmarkXMLAbsURL     9431          9248          -1.94%

benchmark              old allocs     new allocs     delta
BenchmarkAbsURL        24             28             +16.67%
BenchmarkXMLAbsURL     12             14             +16.67%

benchmark              old bytes     new bytes     delta
BenchmarkAbsURL        3295          3424          +3.92%
BenchmarkXMLAbsURL     1954          1987          +1.69%
2015-03-18 17:05:54 +01:00
bep
62752cfee9 Return unmodified content if panic in LiveReloadInject 2015-02-18 22:16:40 +01:00
bep
4d708f096d Add revocer in LiveReloadInject
The panic cannot be reproduced, but add this as protection.

Fixes #911
2015-02-18 21:51:32 +01:00
spf13
7a8b754cad Fixed #301. LiveReload works on any port now. 2014-05-28 19:01:24 -04:00
spf13
be1ee22032 Proper integration of live reload with automatic injection 2014-05-16 17:49:27 -04:00