In `v0.103.0` we added support for `resources.PostProcess` for all file types, not just HTML. We had benchmarks that said we were fine in that department, but those did not consider the static file syncing.
This fixes that by:
* Making sure that the /static syncer always gets its own file system without any checks for the post process token.
* For dynamic files (e.g. rendered HTML files) we add an additional check to make sure that we skip binary files (e.g. images)
Fixes#10328
Looking at the code as a whole, we ended up with a little to much "buttons". It turns out that doing case insensitive matching (lower both pattern and strings to match) performs just fine. Or at least, it
gives the penalty to the people who uses mixed case filenames.
```
GetGlob/Default_cache-10 10.6ns ± 2% 10.6ns ± 1% ~ (p=0.657 n=4+4)
GetGlob/Filenames_cache,_lowercase_searchs-10 10.6ns ± 2% 10.6ns ± 0% ~ (p=1.000 n=4+4)
GetGlob/Filenames_cache,_mixed_case_searchs-10 29.7ns ± 1% 29.6ns ± 1% ~ (p=0.886 n=4+4)
GetGlob/GetGlob-10 13.7ns ± 1% 13.7ns ± 0% ~ (p=0.429 n=4+4)
name old alloc/op new alloc/op delta
GetGlob/Default_cache-10 0.00B 0.00B ~ (all equal)
GetGlob/Filenames_cache,_lowercase_searchs-10 0.00B 0.00B ~ (all equal)
GetGlob/Filenames_cache,_mixed_case_searchs-10 5.00B ± 0% 5.00B ± 0% ~ (all equal)
GetGlob/GetGlob-10 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
GetGlob/Default_cache-10 0.00 0.00 ~ (all equal)
GetGlob/Filenames_cache,_lowercase_searchs-10 0.00 0.00 ~ (all equal)
GetGlob/Filenames_cache,_mixed_case_searchs-10 1.00 ± 0% 1.00 ± 0% ~ (all equal)
GetGlob/GetGlob-10
```
On Linux, `hugofs.Glob` does not hit any directories which includes
uppercase letters. (This does not happen on macOS.)
Since `resources.GetMatch/Match` uses `Glob`,
```
{{ resources.GetMatch "Foo/bar.css" }}
```
this does not match `assets/Foo/bar.css` .
On the other hand, you can get it with
```
{{ resources.Get "Foo/bar.css" }}
```
Simple sites may only have one css file. Update the replace directive to
correctly match single-file sourcemaps and multi-file sourcemaps.
Verified locally with and without SASS and CSS imports.
Fixes#8174
This issue was introduced in `v0.102.0`.
In 223bf28004 we removed the byte source from the parsed page result, which
meant we had to preserve exact positioning for all elements. This introduced some new `TypeIgnore` tokens
which we, wrongly, assumed didn't matter where we put in the result slice (they should be ignored anyway).
But it seems that this broke the logic where we determine if it's positional or named params in the case
where the paramater value contains escaped quoutes.
This commit makes sure that these ignore tokens (the back slashes) are never sent back to the client, which is how it was before `v0.102.0`.
This commit also fixes some lost error information in that same commit.
Fixes#10236
This, together with 'snapcraftctl set-version", negates the need to
modify snap/snapcraft.yaml upon each release, so the corresponding code
is removed from releaser/releaser.go.
Also, vendorInfo is extended to include the snap version number.
See #10225
This allows the use of "git describe --tags" to recognize lightweight
version tags, and the removal of initial "v" in the hugo snap version.
See #10225
Git:
- Set GIT_EXEC_PATH and include usr/lib/git-core so that git can find the
git-remote-https helper (needed by e.g. "go mod download").
Go:
- Put Go in its own snap part, and use stage-snaps instead of build-snaps
so that it is included in the final snap.
- Set GOCACHE to a writable directory. (In a previous commit,
HOME is set to $SNAP_REAL_HOME which is unwritable.)
Hugo:
- Patch config/security/securityConfig.go "[security.exec] osEnv" whitelist
(during snap build) so that external dependencies can use the required
environment variables to run properly from within the snap.
Asciidoctor:
- Replace shebang line in asciidoctor so it can find the ruby executable.
- Set RUBYLIB so that Ruby can find its libraries.
Caveat/TODO: The Ruby version is hardcoded in our custom RUBYLIB.
Embedded Dart Sass:
- Download from GitHub and install it, for amd64 and arm64 only.
Node.js:
- Remove my incomplete include list so that npx is actually installed.
- Set npm_config_{cache,init_module,userconfig} to writable locations.
Pandoc:
- Set pandoc_datadir so that Pandoc can find its data files.
rst2html:
- Install python3-docutils package for rst2html, rst2html5, etc.
- Set PYTHONHOME so that Python can find its libraries.
Note that asciidoctor, pandoc and rst2html are not in Hugo’s default
"[security.exec] allow" whitelist, and the snap package does not change
that default, so they still needed to be whitelisted manually in
config.toml if necessary by the end user.
Special thanks to Joe Mooring (@jmooring) for meticulously diagnosing
the issue and providing a comprehensive test repository at
https://github.com/jmooring/hugo-snap-test without which I would not
have been able to understand and resolve the issue.
Fixes#9078