Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: css cache busting #4177

Prev Previous commit
Next Next commit
Use postcss for minification
tylers-username committed Sep 3, 2024
commit 170dc6aa1a7b6b0c126857943db9498188954419
13 changes: 0 additions & 13 deletions sites/platform/config/_default/config.yaml
Original file line number Diff line number Diff line change
@@ -88,16 +88,3 @@ security:
http:
methods:
- GET

# Minification settings
minify:
minifyOutput: true

# Environment-specific configuration
environments:
production:
minify:
minifyOutput: true
development:
minify:
minifyOutput: false
13 changes: 0 additions & 13 deletions sites/upsun/config/_default/config.yaml
Original file line number Diff line number Diff line change
@@ -96,16 +96,3 @@ security:
- ^HUGO_HEAP_ID
http:
methods: none

# Minification settings
minify:
minifyOutput: true

# Environment-specific configuration
environments:
production:
minify:
minifyOutput: true
development:
minify:
minifyOutput: false
8 changes: 4 additions & 4 deletions themes/psh-docs/layouts/partials/head/css.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<!-- stylesheets using `minify` will be minified in production -->
<!-- Vendor overrides -->
{{ if eq .Site.Params.theme.use_vendor true }}
{{ $vendorCSS := resources.Get "css/vendor.css" | minify | fingerprint }}
{{ $vendorCSS := resources.Get "css/vendor.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $vendorCSS.RelPermalink $.Site.Params.version }}">
{{ end }}

<!-- Asciinema player: moved to tailwind config.css -->

<!-- Syntax highlighting -->
{{ $syntaxHighlightingCSS := resources.Get "css/vendor.css" | minify | fingerprint }}
{{ $syntaxHighlightingCSS := resources.Get "css/vendor.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $syntaxHighlightingCSS.RelPermalink $.Site.Params.version }}">

<!-- TailwindCSS files -->
{{ $mainStyle := resources.Get "css/main.css" | resources.PostCSS | minify | fingerprint }}
{{ $mainStyle := resources.Get "css/main.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $mainStyle.RelPermalink $.Site.Params.version }}">

<!-- Print stylesheets -->
{{ with .File }}
{{- if eq .Dir "security/transparency/" -}}
{{ $transparencyReportsCSS := resources.Get "css/print/transparency-reports.css" | minify | fingerprint }}
{{ $transparencyReportsCSS := resources.Get "css/print/transparency-reports.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ printf "%s?version=%s" $transparencyReportsCSS.RelPermalink $.Site.Params.version }}">
{{- end -}}
{{ end }}
10 changes: 10 additions & 0 deletions themes/psh-docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -7,5 +7,15 @@ module.exports = {
require('autoprefixer')({
path: [themeDir]
}),
...process.env.HUGO_ENVIRONMENT === 'production'
? [
require('cssnano')({
preset: ['default', {
discardComments: { removeAll: true }, // Ensure all comments are removed
normalizeWhitespace: true, // Ensures that whitespace is minimized
}]
})
]
: []
]
}

Unchanged files with check annotations Beta

### Get started
If you're still unfamiliar with {{% vendor/name %}} and how it works, _but_ you're also looking to quickly start working with the platform, the **Get started** section is the right place to begin.

Check warning on line 20 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Emphasis should use `*` as a marker

Check warning on line 20 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Line must be at most 140 characters
Learn the basics of how {{% vendor/name %}} leverages Git to produce reusable build images, identical-to-production environments in staging and development (including production data), as well as the basics of monitoring and troubleshooting your environments.

Check warning on line 22 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Line must be at most 140 characters
Ready to get started? [Let's go!](/get-started/)
### Learn
After going through the **Get started** section, you may want to know more about how {{% vendor/name %}} works and the logic behind it. The **[Learn](/learn/_index.md)** section is a collection of tutorials and conceptual guides to help you understand the ins and outs of {{% vendor/name %}}.

Check warning on line 28 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Line must be at most 140 characters
- [**What is {{% vendor/name %}}?**](/learn/overview/_index.md)

Check warning on line 30 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Incorrect list-item indent: add 2 spaces
With this guide, find out which problem {{% vendor/name %}} is trying to solve.

Check warning on line 32 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Don’t use mixed indentation for children, remove 2 spaces
Learn how {{% vendor/name %}}'s configuration, build and deploy pipelines, and the structure of environments play into the broader philosophy behind reliably deploying applications.

Check warning on line 33 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Line must be at most 140 characters
- [**Tutorials**](/learn/tutorials/_index.md)

Check warning on line 35 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Incorrect list-item indent: add 2 spaces
Once you're familiar with {{% vendor/name %}}, its basic rules and philosophy, you may be curious about how you can replicate common workflows in other tools on our platform.

Check warning on line 37 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Don’t use mixed indentation for children, remove 2 spaces

Check warning on line 37 in sites/platform/src/_index.md

GitHub Actions / Lint markdown (platform)

Line must be at most 140 characters
From scheduling dependency updates and backups to exporting data, the [**Tutorials**](/learn/tutorials/_index.md) provide all the information you need.
- [**Best practices**](/learn/bestpractices/_index.md)
### Get started
If you're still unfamiliar with {{% vendor/name %}} and how it works, _but_ you're also looking to quickly start working with the platform, the **Get started** section is the right place to begin.

Check warning on line 20 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Emphasis should use `*` as a marker

Check warning on line 20 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Line must be at most 140 characters
Learn the basics of how {{% vendor/name %}} leverages Git to produce reusable build images, identical-to-production environments in staging and development (including production data), as well as the basics of monitoring and troubleshooting your environments.

Check warning on line 22 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Line must be at most 140 characters
Ready to get started? [Let's go!](/get-started/here)
### Learn
After going through the **Get started** section, you may want to know more about how {{% vendor/name %}} works and the logic behind it. The **[Learn](/learn/_index.md)** section is a collection of tutorials and conceptual guides to help you understand the ins and outs of {{% vendor/name %}}.

Check warning on line 28 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Line must be at most 140 characters
- [**What is {{% vendor/name %}}?**](/learn/overview/_index.md)

Check warning on line 30 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Incorrect list-item indent: add 2 spaces
With this guide, find out which problem {{% vendor/name %}} is trying to solve.

Check warning on line 32 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Don’t use mixed indentation for children, remove 2 spaces
Learn how {{% vendor/name %}}'s configuration, build and deploy pipelines, and the structure of environments play into the broader philosophy behind reliably deploying applications.

Check warning on line 33 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Line must be at most 140 characters
- [**Tutorials**](/learn/tutorials/_index.md)

Check warning on line 35 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Incorrect list-item indent: add 2 spaces
Once you're familiar with {{% vendor/name %}}, its basic rules and philosophy, you may be curious about how you can replicate common workflows in other tools on our platform.

Check warning on line 37 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Don’t use mixed indentation for children, remove 2 spaces

Check warning on line 37 in sites/upsun/src/_index.md

GitHub Actions / Lint markdown (upsun)

Line must be at most 140 characters
From scheduling dependency updates and backups to exporting data, the [**Tutorials**](/learn/tutorials/_index.md) provide all the information you need.
- [**Best practices**](/learn/bestpractices/_index.md)