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

✨ improve(minor): reasonable defaults for purgecss (@roots/bud-purgecss) #2443

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

kellymears
Copy link
Member

@kellymears kellymears commented Sep 10, 2023

You don't have to call bud.purgecss in order to purge styles.

Shouldn't be a problem for anyone for any reason I can foresee but still a minor bump.

  • Deprecates bud.purgecss method. Removal of this method constitutes a major bump imho, will save for v7.
  • Provide reasonable defaults for purgecss
  • Improve exports organization
  • Improve typings (options API type hinting)
  • Improve tests
  • Improve examples/purgecss

Default behavior:

  • purgecss is enabled in development mode only
  • content is set to:
    • bud.path('@src/*.{html,js,jsx,php,pug,rb,ts,tsx,vue}')
    • bud.path('@src/**/*.{html,js,jsx,php,pug,rb,ts,tsx,vue}')

Updating config

This is pretty easy. The old setup involved calling

bud.purgecss({
  content: [bud.path('src/*.html')],
  css: [bud.path('src/**/*.css')],
})

This is now:

bud.purge
  .setContent([bud.path(`src/*.html`)])
  .setCss([bud.path(`src/**/*.css`)])

Or, as with all extensions, you can use the Options API directly:

bud.purge
  .set(`content`, [bud.path(`src/*.html`)])
  .set(`css`, [bud.path(`src/**/*.css`)])

I really like this style but the type hinting isn't as good.

If you really want to use the plugin in development mode for some reason, you can just call enable:

bud.purge
  .setContent([bud.path(`src/*.html`)])
  .setCss([bud.path(`src/**/*.css`)])
  .enable()

Type of change

PATCH: backwards compatible change

@kellymears kellymears changed the title ✨ improve(patch): reasonable defaults for purgecss (@roots/bud-purgecss) ✨ improve(minor): reasonable defaults for purgecss (@roots/bud-purgecss) Sep 10, 2023
@kellymears kellymears self-assigned this Sep 20, 2023
@kellymears kellymears added the 🚀! automerge label Sep 22, 2023
@kodiakhq kodiakhq bot merged commit 5a39384 into main Sep 22, 2023
8 checks passed
@kodiakhq kodiakhq bot deleted the improve-purgecss branch September 22, 2023 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant