Commit graph

25 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
c19f65f956 minifiers: Make keepWhitespace = true default for HTML
Fixes #8771
2021-07-19 23:35:20 +02:00
Rohan Kumar
02f31897b4
media: support application/manifest+json
The standard file extension for Web App Manifest files is
".webmanifest". This commit allows Hugo to recognize .webmanifest files
as "application/manifest+json" files and to minify them using its
JSON minifier.

The .webmanifest file extension is recommended in the w3c spec to
simplify media type registration:
https://www.w3.org/TR/appmanifest/#media-type-registration

Webhint docs are also relevant:
https://webhint.io/docs/user-guide/hints/hint-manifest-file-extension/

Closes #8624
2021-06-18 13:11:44 +02:00
Bjørn Erik Pedersen
d392893cd7
Misc config loading fixes
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster:

```
BenchmarkDefaultConfigProvider/Viper-16         	  252418	      4546 ns/op	    2720 B/op	      30 allocs/op
BenchmarkDefaultConfigProvider/Custom-16        	  450756	      2651 ns/op	    1008 B/op	       6 allocs/op
```

Fixes #8633
Fixes #8618
Fixes #8630
Updates #8591
Closes #6680
Closes #5192
2021-06-14 17:00:32 +02:00
Bjørn Erik Pedersen
35dedf15c0 deps: Bump github.com/tdewolff/minify/v2 v2.9.15
Fixes #8332
2021-03-20 15:51:20 +01:00
Bjørn Erik Pedersen
66beac99c6 deps: Update github.com/tdewolff/minify/v2 v2.6.2 => v2.9.13
Fixes #8258
2021-02-18 10:19:22 +01:00
Phil Davis
04b89857e1
all: Fix minor typos 2020-12-16 12:11:32 +01:00
Bjørn Erik Pedersen
d90e37e0c6 all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
2020-12-03 13:12:58 +01:00
Bjørn Erik Pedersen
6dd60fca73
Revert "deps: Update to github.com/tdewolff/minify v2.9.4"
Closes #7792

This reverts commit b254532b52.
2020-10-07 10:46:19 +02:00
Bjørn Erik Pedersen
b254532b52 deps: Update to github.com/tdewolff/minify v2.9.4 2020-09-19 21:17:02 +02:00
Bjørn Erik Pedersen
7204b354a9 Some minify configuration adjustments 2020-03-20 20:35:57 +01:00
SatowTakeshi
574c2959b8 Add minify config
Fixes #6750
Updates #6892
2020-03-20 20:35:57 +01:00
Bjørn Erik Pedersen
7ed22e9fb6
Revert to minify v2.6.1
Closes #6791
2020-01-23 17:03:23 +01:00
Bjørn Erik Pedersen
4513801778
minifiers: Update to new CSS config
Update #6719
2020-01-07 18:06:22 +01:00
Bjørn Erik Pedersen
3717db1f90
minifiers: Add a JSON roundtrip test
See #6472
2019-11-03 11:34:22 +01:00
Bjørn Erik Pedersen
9e57182705
tests: Convert from testify to quicktest 2019-08-12 13:26:32 +02:00
Bjørn Erik Pedersen
b5f39d23b8 all: Apply staticcheck recommendations 2019-03-24 16:14:51 +01:00
Bjørn Erik Pedersen
4b5f743959
minifiers: Fixx CSS2 color code handling
Fixes #5506
2018-12-07 07:49:26 +01:00
Bjørn Erik Pedersen
d212f60949 deps: Update minify
No functional changes, just support for Go Modules.
2018-11-07 00:23:08 +01:00
Alexandros
9b26b5487b minifiers: Set minifier to KeepEndTags
See: 948b6490cf/README.md (L171)
2018-09-13 08:16:20 +02:00
James Kiefer
3dafe206e3 minifiers: Make JSON minification more generic
Add a regex matcher for json types. Specifically support LD+JSON which
allows for google seo minification out of the box. Expanded JS/JSON
minification testing.
2018-09-12 19:33:14 +02:00
Bjørn Erik Pedersen
ebb56e8bdb Improve minifier MIME type resolution
This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`.

Fixes #5093
2018-08-28 17:00:53 +02:00
vsopvsop
e6eda2a370 minfiers: Keep end tags
Fixes  #5112
2018-08-25 10:49:15 +02:00
Bjørn Erik Pedersen
5a0ee2b934
minifiers: Do not strip IE conditional statements
Fixes #5089
2018-08-18 11:16:34 +02:00
Bjørn Erik Pedersen
c81fbf4625
minifiers: Make the JS minifier matcher less specific
Fixes #5073
2018-08-14 19:24:33 +02:00
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