Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

fix: updated toolkit to use .module.scss pathing #60

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

dalebaldwin
Copy link

We discovered in our React 18, next js project that the popovers weren't rendering with the correct CSS. This issue was tracked back to the .scss file extension needing to be renamed to .module.scss.

We will need to do an additional canary release on the R18 version of the RTE to get this issue resolved as well.

Copy link

changeset-bot bot commented Nov 1, 2023

🦋 Changeset detected

Latest commit: 460afb1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cultureamp/rich-text-toolkit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@sentience sentience left a comment

Choose a reason for hiding this comment

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

Looks good. Just needs a changeset?

package.json Outdated
@@ -26,7 +26,7 @@
"scripts": {
"build": "tsc --build && yarn copy-files",
"clean": "tsc --build --clean",
"copy-files": "copyfiles -u 1 src/**/*.scss dist/",
"copy-files": "copyfiles -u 1 src/**/*.module.scss dist/",
Copy link
Contributor

Choose a reason for hiding this comment

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

*.module.scss will still be matched against *.scss so this isn't necessary :)
It would actually be safer to leave it in case there are internal scss files (eg. mixins consumed by a file with .module.scss) which are valid.

types.d.ts Outdated
@@ -1,4 +1,4 @@
declare module "*.scss" {
declare module "*.module.scss" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same reasoning for not changing the script. The regex still applies.

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense, I'll switch them back

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this is actually a good change because if you import a .scss file and don't get types for it, that would be a warning sign that you're importing CSS that won't be processed as a CSS module, because you didn't name it .module.scss.

In fact, I'm thinking we might even want to declare module "*.scss" never or something like that as a further guard against importing CSS files that aren't CSS modules.

Perhaps this is overcomplicating things, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Certainly an interesting proposal. The two declarations may fight each other though (haven't tested, so could be wrong). But given this is only a problem because of the combination of this repo not compiling its own styles + Next being opinionated on the filename, it's not necessarily a long term restriction we require.
KAIO for instance compiles its own styles, so this problem would never exist even if we were to name them all without .module.

Given we're looking into potential refactors to RTE + RTT for it to either live or be compatible with KAIO, it's better to leave implementing this for later (if at all) :)

@dalebaldwin
Copy link
Author

@HeartSquared @sentience who has merge permissions on this?

@HeartSquared HeartSquared merged commit 2b4bce2 into main Nov 1, 2023
4 checks passed
@HeartSquared HeartSquared deleted the SR2-1040/css-module-rename-update branch November 1, 2023 00:21
@sentience
Copy link
Member

sentience commented Nov 1, 2023

I do! I expect @HeartSquared does too, but I'll go ahead and merge now.

@github-actions github-actions bot mentioned this pull request Nov 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants