gpbl / react-day-picker

DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications.
https://daypicker.dev
MIT License
6.09k stars 732 forks source link

build(style): support importing styles in Sass #2555

Closed GeorgeTaveras1231 closed 3 weeks ago

GeorgeTaveras1231 commented 3 weeks ago

Pull Request Template

Thanks for your PR! Make sure you have read the CONTRIBUTING guide.

What's Changed

Allows consumers to import base CSS using SASS. This gives consumers more flexibility to manipulate the base CSS. For example, forcing the styles under a CSS layer

@layer third-party-libs {
  @import 'pkg:react-day-picker/styles.module';
}

OR, forcing the styles to be scoped under a selector

.my-daypicker {
  @import 'pkg:react-day-picker/styles.module';
}

Type of Change

Tips for a good PR

Thanks

Additional Notes

Add any extra comments or questions here.

GeorgeTaveras1231 commented 3 weeks ago

@gpbl Sorry if the PR lacked context. Here are some more details:

The issue with the current package.json exports is that Sass requires the extension to be omitted when importing plain CSS - this is necessary for it to differentiate between runtime and build-time imports. See their docs on how @import works.

I will answer the other questions inline 😌

gpbl commented 3 weeks ago

@GeorgeTaveras1231 it makes sense to me! Thanks for your insight here (and for saving me from reading Sass manuals :)

GeorgeTaveras1231 commented 3 weeks ago

Thanks @gpbl! I will be on the lookout for the next release 😌