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

postcss-bundler #1090

Merged
merged 3 commits into from
Aug 24, 2023
Merged

postcss-bundler #1090

merged 3 commits into from
Aug 24, 2023

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Aug 21, 2023

part of #1060


A plugin pack for bundling CSS

The goal is to pass these tests and to do for bundling CSS what postcss-preset-env does for fallbacks.

It uses :

  • an embedded hard fork of postcss-import
  • a new plugin to rebase url() values

I don't intend to include things best left to other tools :

  • doing things with SVG's
  • copying files to a /dist folder
  • doing things with images
  • ...

It is better if this tool adheres to these principles :

  • zero config is a good config
  • CSS authors don't have to re-learn how to write CSS
  • clicking a file link in CSS in a code editor takes you to that file

postcss-import

I initially hoped to be able to use postcss-import directly, but even after fully rewriting that plugin I am still not where I need/want to be. We would still need to override any and every possible thing to make it compatible with the goals I laid out here.

I think it is better to do a hard fork and strip out all the parts we don't intend to use.

After doing this work, I found it was much easier to correctly fix the last remaining issues to pass all tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

This currently only contains some minimal tests, not the full test suite from : https://github.com/romainmenke/css-import-tests

I will add that in a separate PR, because it's just so much and it makes it near impossible to review this.

import postcssRebaseURL from '@csstools/postcss-rebase-url';

/** postcss-bundler plugin options */
export type pluginOptions = never;
Copy link
Member Author

Choose a reason for hiding this comment

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

If useful we can add a features option here in the same style as postcss-preset-env.

Allowing users to enable or disable specific features that do or don't apply to them and their setup.

In the beginning however I want to see how useful it is without any config at all.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense!

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

This looks great!

Can't wait to start using this!

@romainmenke
Copy link
Member Author

Thank you for reviewing all this 🙇

@romainmenke romainmenke merged commit f0efd4a into main Aug 24, 2023
@romainmenke romainmenke deleted the postcss-bundler--frank-yak-8e403c93c6 branch August 24, 2023 13:33
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.

2 participants