Commit graph

5937 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
satotake
71931b30b1 Remove alias of os.Stat 2018-08-06 09:54:26 +02:00
satotake
d40116e5f9 Renmae FileStat Stat 2018-08-06 09:54:26 +02:00
satotake
c362634b7d Fix typo 2018-08-06 09:54:26 +02:00
satotake
d71120852a Add fileStat to tpl/os/os 2018-08-06 09:54:26 +02:00
Bjørn Erik Pedersen
a6b1eb1e91
transform: Reduce allocation in the benchmark itself 2018-08-05 17:27:16 +02:00
Bjørn Erik Pedersen
27110133ff
transform: Simplify the 0 transformer case 2018-08-05 11:24:16 +02:00
hugoreleaser
31faf98ce3 releaser: Prepare repository for 0.47-DEV
[ci skip]
2018-08-01 09:03:22 +00:00
hugoreleaser
f14d773841 releaser: Add release notes to /docs for release of 0.46
[ci skip]
2018-08-01 09:00:52 +00:00
hugoreleaser
3aa838cf2b releaser: Bump versions for release of 0.46
[ci skip]
2018-08-01 09:00:52 +00:00
Bjørn Erik Pedersen
a3a26597cf
Release 0.46 2018-08-01 10:52:45 +02:00
hugoreleaser
92d776b0df releaser: Add release notes draft for 0.46
Rename to *-ready.md to continue. [ci skip]
2018-08-01 08:10:57 +00:00
Bjørn Erik Pedersen
e6dd54943f
Merge commit '766085c2dc6fc95ac30fda2a9ebde2355fc12554' 2018-08-01 10:01:49 +02:00
Bjørn Erik Pedersen
766085c2dc Squashed 'docs/' changes from a4fa0d1d6..81847981f
81847981f Add notes for installing "extended" Sass/SCSS version
02da3bb58 Include usage of disqus internal template
9b53380c4 Update sitemap-template.md
f3417dd52 Update sitemap-template.md
aae33d9a8 Update sitemap-template.md
834edc205 Release 0.45.1
fb93ab905 Merge branch 'temp451'
79f350906 releaser: Prepare repository for 0.46-DEV
25cd2352c releaser: Add release notes to /docs for release of 0.45.1
e60377c71 releaser: Bump versions for release of 0.45.1
873f6dce2 Update features.md
ecc116642 Update link for Azure
cb88c3185 Added .Site.Home to Site Variiables (#541)
975a88791 Document includePaths
56c4e332f Release Hugo 0.45
c22b25210 Merge branch 'temp45'
0ffad3ada releaser: Prepare repository for 0.46-DEV
08d494cc3 releaser: Add release notes to /docs for release of 0.45
ad546ba45 releaser: Bump versions for release of 0.45
971c46bb2 Fixed "Sratch" to become "Scratch" on line 44
a28255bf3 Clarify the meaning of .Pages vs .Site.Pages
127aeee09 docs: Update ref, relref, GetPage docs
350d674ec resources.Concat doesn't have an alias
1fd1219b0 docs: Document refLinksErrorLevel and refLinksNotFoundURL
af2252ff6 Merge commit 'a3535c8486b2ce762b1a8a9c30b03985c3e02cee'
a11486805 Merge commit 'b6b37a1f00f808f3c0d2715f65ca2d3091f36495'
1c8896cb1 Fix addkit link to account for i18n
468aef3fc releaser: Prepare repository for 0.45-DEV
c6f4b97a2 releaser: Add release notes to /docs for release of 0.44
d3985afb7 releaser: Bump versions for release of 0.44
2c59a330c Adjust release notes
83966769a releaser: Prepare repository for 0.44-DEV
e539613f7 releaser: Add release notes to /docs for release of 0.43
2bf648944 releaser: Bump versions for release of 0.43
d9d6e4bf7 Fix typos
d6798afda Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
37cc52261 Add a newScratch template func
1f7f09613 Merge branch 'release-0.42.2'
857b0b26a releaser: Prepare repository for 0.43-DEV

git-subtree-dir: docs
git-subtree-split: 81847981f1f2cb1ebc83d42d275a2afb2bb22df1
2018-08-01 10:01:05 +02:00
Bjørn Erik Pedersen
b5d13ca16b Update Chroma
And since I have updated Dep locally, I get a bunch of other totally unrelated diffs. Which looks innocent enough.

Fixes #5019
2018-08-01 09:34:28 +02:00
Bjørn Erik Pedersen
6b02f5c0f4 Make resources fetched via resources.Get and similar language agnostic
With the newly released Hugo Pipes, resources fetched and processed via `resources.Get` and similar was published to the relevant language sub folder when in multilingual mode.

The thought behind that was maximum flexibility with support for `assetDir` per language.

In practice this was a bad idea:

* You get duplication of identical content, with added processing time
* You end up with path issues that seem to be hard to find a way around (`@fa-font-path` is one example)

This commit changes that. Now there is only one `assetDir` and if you, as one example, need to generate a CSS per langugage, you need to set the paths yourself.

Fixes #5017
2018-07-31 23:33:04 +02:00
Bjørn Erik Pedersen
88e447c449
tocss/scss: Improve _ prefix handling in SCSS imports
See #5008
2018-07-31 16:53:03 +02:00
Rob Jackson
b718d743b7 Fix file paths for uncached transformed images
This commit also fixes an existing test to work according to the correct logic. The test was written based on erroneous behavior. We resize the image to 300x200px, and are now trying to fit it within a 50px square. The longest edge is 300 pixels, so we need to divide it by 6 (300 / 50 == 6). And then scale the shortest edge with the same proportion (200 / 6 == 33.33).

The original test was transforming the original source image, hence the previous values:

900 x 562
900 / 50 == 18
562 / 18 == 31.22

Fixes #5012
2018-07-31 13:31:35 +02:00
Bjørn Erik Pedersen
0ba19c57f1 tpl/partials: Add templates.Exists
Fixes #5010
2018-07-31 13:28:15 +02:00
Bjørn Erik Pedersen
0afa2897a0 tpl/partials: Remove superflous loop
No need to check the themes template prefix.
2018-07-31 13:28:15 +02:00
Bjørn Erik Pedersen
f219ac09f6 tocss/scss: Improve SCSS project vs themes import resolution
Before this commit, only SASS/SCSS  components imported from main.scss at first level can be overwritten by homonymous files in projects or over-preceding theme components.

This commit fixes that by implementing a custom import resolver which will be tried first. This resolver will make sure that the project/theme hierarchy is always respected.

Fixes #5008
2018-07-31 10:54:10 +02:00
Bjørn Erik Pedersen
786f72302f
Fix image cache eviction for sites with subdir in baseURL
Fixes #5006
2018-07-29 14:26:45 +02:00
hugoreleaser
0cae1cf828 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-25 08:58:54 +00:00
hugoreleaser
3b18042ee6 releaser: Add release notes to /docs for release of 0.45.1
[ci skip]
2018-07-25 08:56:21 +00:00
hugoreleaser
e38843f4bf releaser: Bump versions for release of 0.45.1
[ci skip]
2018-07-25 08:56:21 +00:00
Bjørn Erik Pedersen
87f0dc14ab
Release 0.45.1 2018-07-25 10:51:27 +02:00
hugoreleaser
b7d9ab136d releaser: Add release notes draft for 0.45.1
Rename to *-ready.md to continue. [ci skip]
2018-07-25 08:37:50 +00:00
Bjørn Erik Pedersen
04d4c08dbc hugolib: Fix .Site.GetPage regression
In Hugo 0.44 we simplified the `.Site.GetPage` API and added code to handle the old-style syntax in most cases.

This logic did not handle the lookup of the home page via `.Site.GetPage "section" ""` and similar. This commit fixes that.

Fixes #4989
2018-07-24 11:37:59 +02:00
Bjørn Erik Pedersen
016dd4a69a
Add Page.FirstSection
It was added and then removed by accident some time ago. Let us add it again, as it is useful.
2018-07-23 20:20:19 +02:00
Bjørn Erik Pedersen
c6b599a06d hugolib: Fix "borrow content from another language" issue
If a content file contains shortcode(s), we have logic in place to re-render it per output format.

We also have logic in place that avoids making a copy of the content used for this process if we don't need it.

This was before this commit limited to server mode and if the page should be output to multiple formats.

But there is a third case: If a site (language) borrows and renders `.Content` from another language. This would, before this commit, behave oddly for content with shortcodes.

Fixes #4986
2018-07-23 20:12:41 +02:00
hugoreleaser
3a6784b162 releaser: Prepare repository for 0.46-DEV
[ci skip]
2018-07-22 12:12:08 +00:00
hugoreleaser
48d7a641d0 releaser: Add release notes to /docs for release of 0.45
[ci skip]
2018-07-22 12:09:26 +00:00
hugoreleaser
2c5a036def releaser: Bump versions for release of 0.45
[ci skip]
2018-07-22 12:09:26 +00:00
Bjørn Erik Pedersen
592c5b3072
Update release notes 0.45 2018-07-22 14:04:01 +02:00
hugoreleaser
a0c4a3660e releaser: Add release notes draft for 0.45
Rename to *-ready.md to continue. [ci skip]
2018-07-22 10:07:03 +00:00
Bjørn Erik Pedersen
062510cf1f
Get rid of the utils package 2018-07-22 00:35:09 +02:00
Bjørn Erik Pedersen
4e1d0cd9f1
Update hugo_windows.go 2018-07-22 00:09:46 +02:00
Bjørn Erik Pedersen
a451c49fde hugolib: Print a WARNING about relative non-relative ref/relref matches
Fixes #4973
2018-07-21 11:42:07 +02:00
Bjørn Erik Pedersen
ff16c42ed0
hugolib: Allow untyped nil to be merged in lang.Merge
Fixes #4977
2018-07-21 11:41:23 +02:00
Bjørn Erik Pedersen
166483fe12 resource/scss: Add IncludePaths config option
Takes paths relative to the current working dir.

Fixes #4921
2018-07-20 17:50:44 +02:00
Bjørn Erik Pedersen
f01505c910
resource/scss: Fix source maps on Windows
I have tested this OK on

* Windows 10 (it did not work before this commit)
* MacOS

Fixes #4968
2018-07-20 08:00:26 +02:00
Vas Sudanagunta
8278384b96 Increase refLinker test coverage 2018-07-20 07:02:41 +02:00
Bjørn Erik Pedersen
65e610e161
hugolib: Avoid nilpointer in absoluteSourceRef 2018-07-19 22:39:24 +02:00
Vas Sudanagunta
b56d9a1294 Fix typo-logic bug in GetPage 2018-07-19 21:36:10 +02:00
Vas Sudanagunta
d6fde8fa13 Enable test case fixed by commit 501543d4 2018-07-19 20:40:50 +02:00
Vas Sudanagunta
2bac371544
Add test coverage for recent ref overhaul
Closes #4969
2018-07-19 18:32:23 +02:00
Bjørn Erik Pedersen
9b4b97a722
hugolib: Create an adapter from old to new getPage
To make sure we confirm that the existing tests run the correct code path.

Updates #4969
2018-07-19 18:26:10 +02:00
Bjørn Erik Pedersen
501543d4b6
hugolib: Only do page-relative getPage for relative paths
Updates #4969
2018-07-19 17:47:05 +02:00
Bjørn Erik Pedersen
6ffa882349
hugolib: Improve error handling in refLink 2018-07-19 17:17:35 +02:00
Bjørn Erik Pedersen
1eb8b36b38
docs: Update ref, relref, GetPage docs 2018-07-19 17:02:03 +02:00