-
Notifications
You must be signed in to change notification settings - Fork 258
Use Purgecss to reduce the size of our CSS #1291
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,38 @@ | |
| */ | ||
| module.exports = { | ||
| plugins: [ | ||
| // TailwindCSS | ||
| // TailwindCSS. | ||
| require("tailwindcss")("./assets/config/tailwind.config.js"), | ||
|
|
||
| // Apply vendor prefixes for CSS features that aren't | ||
| // fully supported yet. | ||
| // Apply vendor prefixes for CSS features that aren't fully supported yet. | ||
| require("autoprefixer")({ | ||
| overrideBrowserslist: [ | ||
| "last 2 versions" | ||
| ] | ||
| }), | ||
|
|
||
| // Minify the CSS even further. (It works!) | ||
| require('cssnano')({ | ||
| preset: 'default', | ||
| }) | ||
| // Use the following plugins when not building for "development": | ||
| ...process.env.NODE_ENV !== "development" ? [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am I reading this correctly in that the Would we instead just want to move this into a package level variable? Like: |
||
| // Remove unused CSS with Purgecss. | ||
| require("@fullhuman/postcss-purgecss")({ | ||
| // These reference CSS classes. | ||
| content: [ | ||
| "./content/**/*.md", | ||
| "./layouts/**/*.html", | ||
| "./assets/js/search.js" // HTML is produced by this script which references some CSS classes. | ||
| ], | ||
|
|
||
| // HubSpot form classes. | ||
| whitelistPatternsChildren: [/^hs/], | ||
|
|
||
| // Tailwind uses colons. | ||
| defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [] | ||
| }), | ||
|
|
||
| // Minify the CSS even further. | ||
| require('cssnano')({ | ||
| preset: 'default', | ||
| }) | ||
| ] : [], | ||
| ] | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: If a comment is a complete sentence, like on line 11, we'll want proper grammar. (Begin with a capital letter, end with a period.) But for a trivial comment like this, no need to add a period at the end.