Skip to content

Commit

Permalink
configure purgecss to accept tailwindcss classnames
Browse files Browse the repository at this point in the history
* like ".w-1/6" which is ignored and purged by default
* currently we have to define all filetypes used in our project due to
  missing DefaultExtractor fallback by purgecss
  (FullHuman/purgecss#148)
  • Loading branch information
bseber committed Mar 9, 2019
1 parent 4b85854 commit ef2282c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ const config = {
CONTENT_HOST: "http://localhost:3000",
BASE_PATH: process.env.BASE_PATH || "",
},
purgeCss: {
extractors: [
{
extractor: class TailwindExtractor {
static extract(content) {
return content.match(/[A-Za-z0-9:/_-]+/g) || [];
}
},
extensions: ["tailwind.css", "js", "jsx", "svg"].concat([
// TODO remove extensions as soon as DefaultExtractor fallback exists in purgecss.
// see https://github.com/FullHuman/purgecss/issues/148
"jpg",
"jpeg",
"png",
"gif",
]),
},
],
},
assetPrefix: process.env.ASSET_PREFIX || "",
};

Expand Down

0 comments on commit ef2282c

Please sign in to comment.