Repository navigation
Expand file tree
/
Copy pathpurgecss.config.cjs
More file actions
38 lines (38 loc) · 2.05 KB
/
Copy pathpurgecss.config.cjs
File metadata and controls
38 lines (38 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Strips unused Tailwind 2.2.19 rules against the fully built site.
// Retained rules are byte-identical to the CDN file, so there is no visual
// change for classes actually used anywhere in the output.
//
// Regenerate after changing markup that introduces new Tailwind classes:
// npm run build:css (see scripts/build-tailwind.mjs)
// then commit the updated assets/css/tailwind.css.
module.exports = {
content: ['tmp/purge-src/**/*.html', 'tmp/purge-src/**/*.js'],
css: ['tmp/tailwind-src.css'],
// Tailwind-aware extractor: keep `:` `/` `.` `%` in candidate class tokens.
defaultExtractor: (content) => content.match(/[\w-/:%.\[\]!]+/g) || [],
// Classes toggled only at runtime (Alpine `:class`, JS classList) — these do
// appear as literals in the built HTML, but pin them so markup churn is safe.
safelist: {
standard: [
'hidden', 'block', 'flex',
'transform', 'absolute', 'inset-0', 'w-full', 'h-full',
/^rotate-/, /^translate-/, /^opacity-/, /^scale-/,
// Activity-dot colors injected at build time from data/community_stats.json
// (see .github/scripts/fetch-discourse-activity.js + deploy.yml fallback).
// These never appear in committed markup, so pin the whole status palette.
'bg-blue-500', 'bg-green-500', 'bg-purple-500',
'bg-orange-500', 'bg-red-500', 'bg-yellow-500',
// Only rendered inside the calendar's upcoming-events loop, so a CI
// build with zero upcoming events would otherwise purge it.
'group-hover:text-purple-600',
// Only rendered for a calendar entry with `cancelled: true`, and which
// of the two cancelled-event branches (upcoming vs. past) renders
// depends on today's date relative to that entry's startDate. Pin them
// so a date rolling an event from one branch to the other — or no
// cancelled event being in scope at all on a given day — can't flip
// the committed-assets check in build.yml.
'line-through', 'text-red-700', 'px-1.5', 'py-0.5', 'align-middle',
],
},
output: 'assets/css/tailwind.css',
};