estevanmaito / windmill-dashboard-react

❄ A multi theme, completely accessible, ready for production dashboard.
https://windmillui.com/dashboard-react
MIT License
1.01k stars 226 forks source link

Purge breaks build #1

Closed estevanmaito closed 4 years ago

estevanmaito commented 4 years ago

windmill-dashboard-react version: 0.1.0-alpha.1

Relevant code or config:

The content of the required theme: windmill-react-ui defaultTheme

This projects tailwind.config.js

const windmillTheme = require('windmill-react-ui/defaultTheme')

module.exports = {
  purge: ['src/**/*.js', windmillTheme],

What you did:

npm run build

What happened:

TypeError: Cannot read property 'match' of undefined
    at defaultExtractor (D:\windmill-dashboard-react\node_modules\tailwindcss\lib\lib\purgeUnusedStyles.js:93:36)
    at m (D:\windmill-dashboard-react\node_modules\purgecss\lib\purgecss.js:1:3149)
    at x.extractSelectorsFromString (D:\windmill-dashboard-react\node_modules\purgecss\lib\purgecss.js:1:5350)
    at D:\windmill-dashboard-react\node_modules\@fullhuman\postcss-purgecss\lib\postcss-purgecss.js:1:536

Problem description:

Apparently purge doesn't accept an object of styles, but the problem also persists when trying something like:

purge: ['src/**/*.js', 'node_modules/windmill-react-ui/lib/default.js'],

But in this case, instead of an Error, it results in a CSS build without the classes from the default.js files.

estevanmaito commented 4 years ago

The new strategy of encapsulating the Tailwind config object solves this.