Skip to content
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

[CHEC-667] - Bugfix/purge unused styles #233

Merged
merged 9 commits into from Jul 9, 2020
Merged

Conversation

jaepass
Copy link
Contributor

@jaepass jaepass commented Jul 3, 2020

  • Added purge option to tailwind.config and included all template paths using custom tailwind classes

Closes #145

@linear
Copy link

linear bot commented Jul 3, 2020

tailwind.config.js Outdated Show resolved Hide resolved
@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 3, 2020

Hmmmn. Unfortunately that breaks the deploy preview storybook. So maybe we need to set the purge paths differently when building the storybook? This has gotten a little challenging.

@jaepass
Copy link
Contributor Author

jaepass commented Jul 3, 2020

hmmmmm is right, will continue to investigate!

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 6, 2020

Okay I'm not sure how we can do this. We don't want to include stories in our configuration when building the bundle (yarn build-lib) but we do want to include it when building the storybook (yarn storybook:build). Maybe there's a way you can determine what command is running with an environment variable?

@@ -16,6 +16,16 @@ const fontSizes = {
'5xl': '2.5rem',
};
module.exports = {
purge: {
enabled: process.env.NODE_ENV === 'production',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Vue CLI takes care of enabling this for you in production already, so I don't think you need this line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Might be wrong)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you're right i did come across this, it does by default. after some digging, think the issue is that the tailwind extractor does not include mdx ext.

will try your above suggestion with seeing which command is running

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 6, 2020

Just disabling the purgecss for storybook building is probably an acceptable workaround too.

@jaepass
Copy link
Contributor Author

jaepass commented Jul 7, 2020

wait so looks like PurgeCss was added as a built-in in v1.4 which should then allow for the purge option in the configuration. https://github.com/tailwindcss/tailwindcss/releases
tailwindlabs/tailwindcss#1639
let me know if i should go ahead and upgrade to 1.4

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 7, 2020

Oh right. That's probably worth doing. We've already updated dashboard a while back.

@jaepass jaepass force-pushed the bugfix/purge-unused-styles branch from 39701fb to c1c7cd1 Compare July 7, 2020 04:41
@jaepass jaepass marked this pull request as draft July 7, 2020 19:30
@jaepass
Copy link
Contributor Author

jaepass commented Jul 8, 2020

oh shucks its still purging storybook...

tailwind.config.js Outdated Show resolved Hide resolved
@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 8, 2020

My bad - that should probably fix it.

Co-authored-by: Guy Marriott <guy@chec.io>
@jaepass jaepass marked this pull request as ready for review July 8, 2020 20:40
@jaepass
Copy link
Contributor Author

jaepass commented Jul 8, 2020

all good now thanks for you help on this!

@jaepass
Copy link
Contributor Author

jaepass commented Jul 8, 2020

you're going to laugh to know i spent a good portion of last night adding those whitelist elements... lol

@ScopeyNZ ScopeyNZ merged commit 7ccd0c4 into master Jul 9, 2020
@ScopeyNZ ScopeyNZ deleted the bugfix/purge-unused-styles branch August 14, 2020 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tailwind is not purging unused styles because no template paths have been provided
2 participants