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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert preflight to plugin #650

Merged
merged 4 commits into from Feb 8, 2019

Conversation

Projects
None yet
3 participants
@adamwathan
Copy link
Member

adamwathan commented Feb 7, 2019

This PR converts our preflight styles into a core plugin and removes the @tailwind preflight directive, with our preflight styles being rendered at @tailwind base instead since they are now added by a plugin.

Preflight can now be disabled in the corePlugins section of the config:

module.exports = {
  corePlugins: {
    preflight: false,
  }
}

...which makes it easy for end users to use other plugins that might add base styles without being required to use preflight.

@benface this one might interest you 馃憤

adamwathan added some commits Feb 7, 2019

Don't handle preflight separately in corePlugins
If we do, we have to handle disabling/custom configuration separately too, which we don't want.

This really suggests I should prioritize adding a more black-box level test for this part of the codebase.
@benface

This comment has been minimized.

Copy link
Contributor

benface commented Feb 7, 2019

Yeah very nice 馃憤

Is the order of the base styles in the generated CSS the same as the order in which the plugins are loaded? I imagine if Preflight is a core plugin, there's no way to add any base style before it? I'm thinking the order is especially important here, because some base styles can override others.

@adamwathan

This comment has been minimized.

Copy link
Member Author

adamwathan commented Feb 8, 2019

Yeah you're right the plugin order will matter for sure. Worst case scenario you can always disable preflight as a core plugin and re-include it as a third party plugin if you want to control the order:

module.exports = {
  corePlugins: {
    preflight: false,
  },
  plugins: [
    require('my-custom-base-styles')(),
    require('tailwindcss/plugins/preflight')(),
  ],
}

@adamwathan adamwathan merged commit e6371fc into next Feb 8, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@adamwathan adamwathan deleted the preflight-plugin branch Feb 8, 2019

@hacknug

This comment has been minimized.

Copy link
Contributor

hacknug commented Feb 9, 2019

Sanitize.css here we go. Thanks @adamwathan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment