mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Squashed 'docs/' changes from 60dd993a6..71f739460
71f739460content: Reformat procedures to use description lists instead of H3 elements420a78802content: Remove 21YunBox hosting guideabeea342fcontent: Add hosting guide for Vercel3aaca6c0acontent: Add hosting guide for Renderd77b06aa6content: Fix formatting82885415fcontent: Change build.sh file perms in Cloudflare hosting docs0569c68cacontent: Fix typo8f14be5dacontent: Remove duplicate list itemse76f17815misc: Fix typo in configuration for the Markdown linter32e450b7cmisc: Fix typo in configuration for the Markdown linter81bd0056amics: Update configuration for the Markdown linter480ae9014content: Improve file names in the PageInner descriptionb17999021content: Adjust Markdown to pass linter tests1d9d56897misc: Implement Markdown linter91fc34c58content: Miscellaneous editsb7c60ae0bcontent: Add admonition for outdated learning resources51b6df588misc: Activate stale action84a897f5fmisc: Implement stale action167ea9713content: Update GitHub Pages workflow example3672d9116misc: Use actions/checkout@v5 in workflows2f2b4c968misc: Update spellcheck configs55a8ff7aecontent: Fix typo36e3d7b7bAdjust sponsors51014e6b9content: Fix link37cfc093fcontent: Add Cloudflare Worker hosting instructions09862ffadcontent: Update hosting considerations related to GitInfo477f3e7c0misc: Update cspell config7a7bb4874content: Miscellaneous edits48486d5accontent: Remove Cloudflare Pages documentation382f8052dcontent: Remove KeyCDN documentation8ecbc985ccontent: Update hosting workflow files57fd362bfcontent: Clarify applicability of the slug front matter field0dcfff9c7content: Update directory-structure.md58e3609a0content: Fix typo22fb43695content: Fix search/replace errorsfba8342a8content: Fix missing link refs97e035006Update netlify.toml6ab5ae6dfcontent: Improve GitLab Pages compression performance172bfbc4bcontent: Differentiate content view templates from other templates978770fc8content: Clarify handling of goldmark extensions conflictcb74aa4c7content: Improve Codeberg Pages hosting instructions794477792content: Add custom domain instructions to Codeberg Pages setup235fac27dcontent: Improve description of code block render hook options map35a507d31content: Improve WP2Hugo description8191f4dcfcontent: Improve WP2Hugo description25cca30fdcontent: Fix typee955652aecontent: Improve base template description922aa91bdcontent: Improve description of partial lookup logic072536ef6content: Update template type documentation5bf153531Update netlify.tomlcdd20a433content: Indicate language sort order for relevant page methodsfc9a868c9content: Add Sitepins to list of commercial CMS platformsb6077449ccontent: Update version referencesb71388caccontent: Fix typoc27dfdef3content: Move link referenced008ea6accontent: Fix typo040f14a3ccontent: Fix typo1ac119d26content: Fix typoa5a4fa907content: More updates for v0.148.0b7247a8eacontent: Remove command chaining from GitHub Actions workflow6ecb96bcdcontent: Updates for v0.148.0aea9e4c29netlify: Update Hugo version4e71546d1Add Ancestors (plural) method to GitInfo, rename Ancestor field to Parent68620a6c2source: Expose Ancestor in GitInfo git-subtree-dir: docs git-subtree-split:71f739460f
This commit is contained in:
@@ -122,83 +122,31 @@ Run `hugo env` to list the active transpilers.
|
||||
|
||||
### Installing in a production environment
|
||||
|
||||
For [CI/CD](g) 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.
|
||||
To use Dart Sass with Hugo on a CI/CD platform like GitHub Pages, GitLab Pages, or Netlify, you typically must modify your build workflow to install Dart Sass before the Hugo site build begins. This is because these platforms don't have Dart Sass pre-installed, and Hugo needs it to process your Sass files.
|
||||
|
||||
[^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.
|
||||
There's one key exception where you can skip this step: you have committed your `resources` directory to your repository. This is only possible if:
|
||||
|
||||
#### GitHub Pages
|
||||
- You have not changed Hugo's default asset cache location.
|
||||
- You have not set [`useResourceCacheWhen`] to never in your sites configuration.
|
||||
|
||||
To install Dart Sass for your builds on GitHub Pages, add this step to the GitHub Pages workflow file:
|
||||
By committing the `resources` directory, you're providing the pre-built CSS files directly to your CI/CD service, so it doesn't need to run the Sass compilation itself.
|
||||
|
||||
```yaml
|
||||
- name: Install Dart Sass
|
||||
run: sudo snap install dart-sass
|
||||
```
|
||||
For examples of how to install Dart Sass in a production environment, see the following workflow files:
|
||||
|
||||
#### GitLab Pages
|
||||
|
||||
To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file should look something like this:
|
||||
|
||||
```yaml
|
||||
variables:
|
||||
HUGO_VERSION: 0.147.9
|
||||
DART_SASS_VERSION: 1.89.2
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
TZ: America/Los_Angeles
|
||||
image:
|
||||
name: golang:1.20-buster
|
||||
pages:
|
||||
script:
|
||||
# Install Dart Sass
|
||||
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- cp -r dart-sass/* /usr/local/bin
|
||||
- rm -rf dart-sass*
|
||||
# Install Hugo
|
||||
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
# Build
|
||||
- hugo --gc --minify
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
```
|
||||
|
||||
#### Netlify
|
||||
|
||||
To install Dart Sass for your builds on Netlify, the `netlify.toml` file should look something like this:
|
||||
|
||||
```toml
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.147.9"
|
||||
DART_SASS_VERSION = "1.89.2"
|
||||
NODE_VERSION = "22"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
publish = "public"
|
||||
command = """\
|
||||
curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
export PATH=/opt/build/repo/dart-sass:$PATH && \
|
||||
hugo --gc --minify \
|
||||
"""
|
||||
```
|
||||
- [GitHub Pages]
|
||||
- [GitLab Pages]
|
||||
- [Netlify]
|
||||
|
||||
[`publishDir`]: /configuration/all/#publishdir
|
||||
[`useResourceCacheWhen`]: /configuration/build/#useresourcecachewhen
|
||||
[brew.sh]: https://brew.sh/
|
||||
[chocolatey.org]: https://community.chocolatey.org/packages/sass
|
||||
[dart sass]: https://sass-lang.com/dart-sass
|
||||
[GitHub Pages]: /host-and-deploy/host-on-github-pages/#step-7
|
||||
[GitLab Pages]: /host-and-deploy/host-on-gitlab-pages/#configure-gitlab-cicd
|
||||
[libsass]: https://sass-lang.com/libsass
|
||||
[Netlify]: /host-and-deploy/host-on-netlify/#configuration-file
|
||||
[prebuilt binaries]: https://github.com/sass/dart-sass/releases/latest
|
||||
[scoop.sh]: https://scoop.sh/#/apps?q=sass
|
||||
[site configuration]: /configuration/build/
|
||||
[snap package]: /installation/linux/#snap
|
||||
[snapcraft.io]: https://snapcraft.io/dart-sass
|
||||
[starter workflow]: https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml
|
||||
[`publishDir`]: /configuration/all/#publishdir
|
||||
|
||||
Reference in New Issue
Block a user