Skip to content

Commit cb52d2c

Browse files
authored
Merge pull request #1734 from gethinode/templatev2
Templatev2
2 parents b4bab77 + 4be3883 commit cb52d2c

File tree

9 files changed

+219
-442
lines changed

9 files changed

+219
-442
lines changed

config/postcss.config.js

Lines changed: 65 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const autoprefixer = require('autoprefixer')({})
22
const cssnano = require('cssnano')({
3-
preset: 'advanced'
3+
preset: ['advanced', {
4+
discardUnused: {
5+
fontFace: false // Preserve all @font-face declarations
6+
}
7+
}]
48
})
5-
const whitelister = require('purgecss-whitelister')
69
const purgeImport = require('@fullhuman/postcss-purgecss')
710
const purgeCSSPlugin = purgeImport.purgeCSSPlugin || purgeImport.default || purgeImport
811
const purgecss = purgeCSSPlugin({
@@ -12,38 +15,66 @@ const purgecss = purgeCSSPlugin({
1215
return [...(els.tags || []), ...(els.classes || []), ...(els.ids || [])]
1316
},
1417
dynamicAttributes: ['data-bs-theme', 'data-bs-theme-animate'],
15-
safelist: ['was-validated',
16-
...whitelister([
17-
'./assets/scss/components/_clipboard.scss',
18-
'./assets/scss/components/_command.scss',
19-
'./assets/scss/components/_nav.scss',
20-
'./assets/scss/components/_navbar.scss',
21-
'./assets/scss/components/_pagination.scss',
22-
'./assets/scss/components/_search.scss',
23-
'./assets/scss/components/_syntax.scss',
24-
'./assets/scss/components/_syntax-dark.scss',
25-
'./assets/scss/components/_syntax-light.scss',
26-
'./assets/scss/components/_table.scss',
27-
'./assets/scss/components/_testimonial.scss',
28-
'./assets/scss/components/_video.scss',
29-
'./assets/scss/theme/fonts.scss',
30-
'./assets/scss/theme/theme.scss',
31-
'./component-library/components/list/list.scss',
32-
'./_vendor/github.com/gethinode/mod-cookieyes/v2/assets/scss/cookieyes.scss',
33-
'./_vendor/github.com/gethinode/mod-flexsearch/v3/assets/scss/modules/flexsearch/flexsearch.scss',
34-
'./_vendor/github.com/gethinode/mod-katex/dist/katex.scss',
35-
'./_vendor/github.com/gethinode/mod-leaflet/v2/dist/leaflet.scss',
36-
'./_vendor/github.com/gethinode/mod-mermaid/v3/assets/scss/mermaid.scss',
37-
'./_vendor/github.com/gethinode/mod-simple-datatables/v3/dist/simple-datatables.scss',
38-
'./_vendor/github.com/twbs/bootstrap/scss/_carousel.scss',
39-
'./_vendor/github.com/twbs/bootstrap/scss/_dropdown.scss',
40-
'./_vendor/github.com/twbs/bootstrap/scss/_modal.scss',
41-
'./_vendor/github.com/twbs/bootstrap/scss/_reboot.scss',
42-
'./_vendor/github.com/twbs/bootstrap/scss/_tooltip.scss',
43-
'./_vendor/github.com/twbs/bootstrap/scss/_transitions.scss',
44-
'./_vendor/github.com/twbs/bootstrap/scss/_utilities.scss'
45-
])
46-
]
18+
fontFace: false,
19+
safelist: {
20+
standard: [
21+
// Bootstrap form validation
22+
'was-validated',
23+
// Bootstrap dynamic states
24+
'show',
25+
'showing',
26+
'hiding',
27+
'active',
28+
'disabled',
29+
'collapsed',
30+
'collapsing'
31+
],
32+
// Classes with these patterns will be preserved along with their children
33+
deep: [
34+
// Bootstrap components that get dynamically modified
35+
/modal/,
36+
/dropdown/,
37+
/carousel/,
38+
/tooltip/,
39+
/popover/,
40+
/collapse/,
41+
/offcanvas/
42+
],
43+
// Preserve any selector containing these patterns
44+
greedy: [
45+
// Third-party library prefixes (well-namespaced, safe to use greedy)
46+
/^fa-/, // FontAwesome
47+
/^leaflet-/, // Leaflet maps
48+
/^katex-/, // KaTeX math (note: using katex- not just katex)
49+
/^mermaid/, // Mermaid diagrams
50+
/^datatable/i, // SimpleDatatables
51+
/^cky-/, // CookieYes
52+
53+
// Component-specific prefixes
54+
/clipboard-/, // Clipboard component
55+
/command-/, // Command component
56+
/search-/, // Search functionality
57+
/suggestion__/, // Search suggestions (FlexSearch)
58+
/testimonial-/, // Testimonial component
59+
60+
// Syntax highlighting (multiple possible engines)
61+
/^hljs-/, // highlight.js
62+
/^language-/, // Prism/generic
63+
/^chroma-/, // Chroma (Hugo's highlighter)
64+
/^highlight/, // Generic highlighting classes
65+
66+
// Pagination and navigation
67+
/page-item/,
68+
/page-link/,
69+
/nav-item/,
70+
/nav-link/,
71+
/navbar-/,
72+
73+
// Bootstrap transitions and utilities that get added via JS
74+
/fade/,
75+
/^translate/ // Bootstrap utilities
76+
]
77+
}
4778
})
4879

4980
module.exports = {

exampleSite/config/postcss.config.js

Lines changed: 65 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
const autoprefixer = require('autoprefixer')({})
22
const cssnano = require('cssnano')({
3-
preset: 'advanced'
3+
preset: ['advanced', {
4+
discardUnused: {
5+
fontFace: false // Preserve all @font-face declarations
6+
}
7+
}]
48
})
5-
const whitelister = require('purgecss-whitelister')
69
const purgeImport = require('@fullhuman/postcss-purgecss')
710
const purgeCSSPlugin = purgeImport.purgeCSSPlugin || purgeImport.default || purgeImport
811
const purgecss = purgeCSSPlugin({
@@ -12,38 +15,66 @@ const purgecss = purgeCSSPlugin({
1215
return [...(els.tags || []), ...(els.classes || []), ...(els.ids || [])]
1316
},
1417
dynamicAttributes: ['data-bs-theme', 'data-bs-theme-animate'],
15-
safelist: ['was-validated',
16-
...whitelister([
17-
'./assets/scss/components/_clipboard.scss',
18-
'./assets/scss/components/_command.scss',
19-
'./assets/scss/components/_nav.scss',
20-
'./assets/scss/components/_navbar.scss',
21-
'./assets/scss/components/_pagination.scss',
22-
'./assets/scss/components/_search.scss',
23-
'./assets/scss/components/_syntax.scss',
24-
'./assets/scss/components/_syntax-dark.scss',
25-
'./assets/scss/components/_syntax-light.scss',
26-
'./assets/scss/components/_table.scss',
27-
'./assets/scss/components/_testimonial.scss',
28-
'./assets/scss/components/_video.scss',
29-
'./assets/scss/theme/fonts.scss',
30-
'./assets/scss/theme/theme.scss',
31-
'./component-library/components/list/list.scss',
32-
'./_vendor/github.com/gethinode/mod-cookieyes/v2/assets/scss/cookieyes.scss',
33-
'./_vendor/github.com/gethinode/mod-flexsearch/v3/assets/scss/modules/flexsearch/flexsearch.scss',
34-
'./_vendor/github.com/gethinode/mod-katex/dist/katex.scss',
35-
'./_vendor/github.com/gethinode/mod-leaflet/v2/dist/leaflet.scss',
36-
'./_vendor/github.com/gethinode/mod-mermaid/v3/assets/scss/mermaid.scss',
37-
'./_vendor/github.com/gethinode/mod-simple-datatables/v3/dist/simple-datatables.scss',
38-
'./_vendor/github.com/twbs/bootstrap/scss/_carousel.scss',
39-
'./_vendor/github.com/twbs/bootstrap/scss/_dropdown.scss',
40-
'./_vendor/github.com/twbs/bootstrap/scss/_modal.scss',
41-
'./_vendor/github.com/twbs/bootstrap/scss/_reboot.scss',
42-
'./_vendor/github.com/twbs/bootstrap/scss/_tooltip.scss',
43-
'./_vendor/github.com/twbs/bootstrap/scss/_transitions.scss',
44-
'./_vendor/github.com/twbs/bootstrap/scss/_utilities.scss'
45-
])
46-
]
18+
fontFace: false,
19+
safelist: {
20+
standard: [
21+
// Bootstrap form validation
22+
'was-validated',
23+
// Bootstrap dynamic states
24+
'show',
25+
'showing',
26+
'hiding',
27+
'active',
28+
'disabled',
29+
'collapsed',
30+
'collapsing'
31+
],
32+
// Classes with these patterns will be preserved along with their children
33+
deep: [
34+
// Bootstrap components that get dynamically modified
35+
/modal/,
36+
/dropdown/,
37+
/carousel/,
38+
/tooltip/,
39+
/popover/,
40+
/collapse/,
41+
/offcanvas/
42+
],
43+
// Preserve any selector containing these patterns
44+
greedy: [
45+
// Third-party library prefixes (well-namespaced, safe to use greedy)
46+
/^fa-/, // FontAwesome
47+
/^leaflet-/, // Leaflet maps
48+
/^katex-/, // KaTeX math (note: using katex- not just katex)
49+
/^mermaid/, // Mermaid diagrams
50+
/^datatable/i, // SimpleDatatables
51+
/^cky-/, // CookieYes
52+
53+
// Component-specific prefixes
54+
/clipboard-/, // Clipboard component
55+
/command-/, // Command component
56+
/search-/, // Search functionality
57+
/suggestion__/, // Search suggestions (FlexSearch)
58+
/testimonial-/, // Testimonial component
59+
60+
// Syntax highlighting (multiple possible engines)
61+
/^hljs-/, // highlight.js
62+
/^language-/, // Prism/generic
63+
/^chroma-/, // Chroma (Hugo's highlighter)
64+
/^highlight/, // Generic highlighting classes
65+
66+
// Pagination and navigation
67+
/page-item/,
68+
/page-link/,
69+
/nav-item/,
70+
/nav-link/,
71+
/navbar-/,
72+
73+
// Bootstrap transitions and utilities that get added via JS
74+
/fade/,
75+
/^translate/ // Bootstrap utilities
76+
]
77+
}
4778
})
4879

4980
module.exports = {

exampleSite/content/en/blocks/_index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,5 @@ content_blocks:
3030
paginate: true
3131
cover: false
3232
header-style: none
33-
class: border-1
33+
class: border-1 card-emphasize
3434
---
35-
36-
<!-- TODO: fix pagination -->

0 commit comments

Comments
 (0)