Merge commit '346b60358dd8ec2ca228e6635bff9d7914b398b7'

This commit is contained in:
Bjørn Erik Pedersen
2025-01-23 09:47:46 +01:00
384 changed files with 3305 additions and 3271 deletions

View File

@@ -18,7 +18,7 @@ aliases: [/assets/]
This is about global and remote resources.
global resource
: A file within the assets directory, or within any directory [mounted] to the assets directory.
: A file within the `assets` directory, or within any directory [mounted] to the `assets` directory.
remote resource
: A file on a remote server, accessible via HTTP or HTTPS.
@@ -51,7 +51,7 @@ See the [`resources.Copy`](/functions/resources/copy/) function.
## Asset directory
Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
Asset files must be stored in the asset directory. This is `assets` by default, but can be configured via the configuration file's `assetDir` key.
## Asset publishing

View File

@@ -11,5 +11,4 @@ menu:
weight: 60
---
See [JS functions](/functions/js/).

View File

@@ -23,7 +23,7 @@ A prime use case for this is [CSS purging with PostCSS](#css-purging-with-postcs
There are currently two limitations to this:
1. This only works in `*.html` templates (i.e. templates that produces HTML files).
2. You cannot manipulate the values returned from the resource's methods. E.g. the `upper` in this example will not work as expected:
1. You cannot manipulate the values returned from the resource's methods. E.g. the `upper` in this example will not work as expected:
```go-html-template
{{ $css := resources.Get "css/main.css" }}
@@ -37,7 +37,7 @@ There are currently two limitations to this:
There are several ways to set up CSS purging with PostCSS in Hugo. If you have a simple project, you should consider going the simpler route and drop the use of `resources.PostProcess` and just extract keywords from the templates. See the [Tailwind documentation](https://tailwindcss.com/docs/controlling-file-size/#app) for some examples.
{{% /note %}}
The below configuration will write a `hugo_stats.json` file to the project root as part of the build. If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory).
The below configuration will write a `hugo_stats.json` file to the project root as part of the build. If you're only using this for the production build, you should consider placing it below [`config/production`](/getting-started/configuration/#configuration-directory).
{{< code-toggle file=hugo >}}
[build.buildStats]
@@ -88,7 +88,7 @@ HUGO_ENVIRONMENT
: The value e.g. set with `hugo -e production` (defaults to `production` for `hugo` and `development` for `hugo server`).
HUGO_PUBLISHDIR
: The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:
: The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this directory from PostCSS when running the server, you could run the server with one of these flags:
```sh
hugo server --renderToDisk

View File

@@ -117,7 +117,7 @@ Run `hugo env` to list the active transpilers.
For [CI/CD] deployments (e.g., GitHub Pages, GitLab Pages, Netlify, etc.) you must edit the workflow to install Dart Sass before Hugo builds the site[^2]. Some providers allow you to use one of the package managers above, or you can download and extract one of the prebuilt binaries.
[^2]: You do not have to do this if (a) you have not modified the assets cache location, and (b) you have not set `useResourceCacheWhen` to `never` in your [site configuration], and (c) you add and commit your resources directory to your repository.
[^2]: You do not have to do this if (a) you have not modified the assets cache location, and (b) you have not set `useResourceCacheWhen` to `never` in your [site configuration], and (c) you add and commit your `resources` directory to your repository.
#### GitHub Pages
@@ -136,8 +136,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file
```yaml
variables:
HUGO_VERSION: 0.137.1
DART_SASS_VERSION: 1.80.6
HUGO_VERSION: 0.141.0
DART_SASS_VERSION: 1.83.4
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
@@ -170,8 +170,9 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should
```toml
[build.environment]
HUGO_VERSION = "0.137.1"
DART_SASS_VERSION = "1.80.6"
HUGO_VERSION = "0.141.0"
DART_SASS_VERSION = "1.83.4"
NODE_VERSION = "22"
TZ = "America/Los_Angeles"
[build]