Skip to content

Commit

Permalink
Merge pull request #1359 from gethinode/develop
Browse files Browse the repository at this point in the history
Improve purge settings
  • Loading branch information
markdumay authored Jan 11, 2025
2 parents 45bd45c + 0e4c493 commit ddc319e
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 45 deletions.
2 changes: 1 addition & 1 deletion config/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
const els = JSON.parse(content).htmlElements
return [...(els.tags || []), ...(els.classes || []), ...(els.ids || [])]
},
dynamicAttributes: ['data-bs-theme'],
dynamicAttributes: ['data-bs-theme', 'data-bs-theme-animate'],
safelist: ['was-validated',
...whitelister([
'./assets/scss/components/_clipboard.scss',
Expand Down
2 changes: 1 addition & 1 deletion exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
# themeFontPath = "https://fonts.googleapis.com/css2?family=Inter:wght@200;300;600&display=swap" # external path
themeFontPath = "/fonts" # local path
themeFontPreload = "/fonts/inter-v12-latin-regular.woff2"
purge = false # TODO: fix purge setting of example site
purge = true
# toml-docs-end theme-colors

[schema]
Expand Down
31 changes: 16 additions & 15 deletions exampleSite/config/postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@ const cssnano = require('cssnano')({
})
const whitelister = require('purgecss-whitelister')
const purgecss = require('@fullhuman/postcss-purgecss')({
content: ['./hugo_stats.json'],
content: ['./exampleSite/hugo_stats.json'],
defaultExtractor: (content) => {
const els = JSON.parse(content).htmlElements
return [...(els.tags || []), ...(els.classes || []), ...(els.ids || [])]
},
dynamicAttributes: ['data-bs-theme'],
dynamicAttributes: ['data-bs-theme', 'data-bs-theme-animate'],
safelist: ['was-validated',
...whitelister([
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_clipboard.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_command.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_nav.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_navbar.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_search.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_syntax.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_syntax-dark.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_syntax-light.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_table.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/components/_video.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/theme/fonts.scss',
'./_vendor/github.com/gethinode/hinode/assets/scss/theme/theme.scss',
'./exampleSite/_vendor/github.com/gethinode/mod-cookieyes/v2/assets/scss/cookieyes.scss',
'./assets/scss/components/_clipboard.scss',
'./assets/scss/components/_command.scss',
'./assets/scss/components/_nav.scss',
'./assets/scss/components/_navbar.scss',
'./assets/scss/components/_search.scss',
'./assets/scss/components/_syntax.scss',
'./assets/scss/components/_syntax-dark.scss',
'./assets/scss/components/_syntax-light.scss',
'./assets/scss/components/_table.scss',
'./assets/scss/components/_video.scss',
'./assets/scss/theme/fonts.scss',
'./assets/scss/theme/theme.scss',
'./_vendor/github.com/gethinode/mod-cookieyes/v2/assets/scss/cookieyes.scss',
'./_vendor/github.com/gethinode/mod-flexsearch/v2/assets/scss/modules/flexsearch/flexsearch.scss',
'./_vendor/github.com/gethinode/mod-katex/dist/katex.scss',
'./_vendor/github.com/gethinode/mod-leaflet/dist/leaflet.scss',
'./_vendor/github.com/gethinode/mod-simple-datatables/dist/simple-datatables.scss',
'./_vendor/github.com/twbs/bootstrap/scss/_carousel.scss',
'./_vendor/github.com/twbs/bootstrap/scss/_dropdown.scss',
'./_vendor/github.com/twbs/bootstrap/scss/_modal.scss',
Expand Down
105 changes: 79 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gethinode/hinode",
"version": "0.27.27",
"version": "0.27.28",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [
"hugo",
Expand Down Expand Up @@ -69,7 +69,7 @@
},
"homepage": "https://gethinode.com",
"dependencies": {
"@fullhuman/postcss-purgecss": "^7.0.2",
"@fullhuman/postcss-purgecss": "~6.0.0",
"autoprefixer": "^10.4.20",
"cssnano": "^7.0.6",
"cssnano-preset-advanced": "^7.0.6",
Expand Down

0 comments on commit ddc319e

Please sign in to comment.