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

Add SASS prefix handler #2016

Merged
merged 8 commits into from
Jun 11, 2024
Merged

Add SASS prefix handler #2016

merged 8 commits into from
Jun 11, 2024

Conversation

JetyAdam
Copy link

@JetyAdam JetyAdam commented Jun 6, 2024

Jira ticket: RHCLOUD-24774

@JetyAdam JetyAdam marked this pull request as ready for review June 6, 2024 14:12
@JetyAdam JetyAdam requested review from Hyperkid123 and a team June 7, 2024 07:43
Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Could you extract te function to a separate file. Also write some tests for the input/output.

packages/config/src/lib/createConfig.ts Outdated Show resolved Hide resolved
packages/config/src/lib/createConfig.ts Outdated Show resolved Hide resolved
packages/config/src/lib/createConfig.ts Outdated Show resolved Hide resolved
packages/config/src/lib/createConfig.ts Outdated Show resolved Hide resolved
packages/config/src/lib/createConfig.ts Outdated Show resolved Hide resolved
@Hyperkid123
Copy link
Contributor

Add a custom matcher pealse to remove the replace for all the strings.

// slice the selector before that, if it's top level selector, add prefix in a scope above, if its nested, dont care

const addPrefixToContent = (content: string, sassPrefix: string): string => {
// Stack to store pairs of opening and closing curly brace indexes
Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead of building a custom parser, we can utilise sass' compileString function? https://sass-lang.com/documentation/js-api/functions/compilestring/

Copy link
Member

Choose a reason for hiding this comment

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

Hm. I thought maybe compileString would allow to have a more structured representation of the css, but it's just a string too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, we don't want to compile, we will leave that to saas. We just want to not prefix css rules that match the app name. To allow styling the root element. I think is a manual process. I wish there was some nice AST for scss that is not 10 years old.

@Hyperkid123 Hyperkid123 added the release Once merged it will trigger bugfix release label Jun 11, 2024
@Hyperkid123 Hyperkid123 merged commit 334a271 into RedHatInsights:master Jun 11, 2024
2 checks passed
@nacho-bot
Copy link
Collaborator

                      :soon::shipit::octocat:
     :bug:Shipit Squirrel has this release bugfix surrounded, be ready for a new version:beetle:

@nacho-bot
Copy link
Collaborator

     🌱 🌸 🌷 🌻 🌟 New version of package has been released 🌟 🌻 🌷 🌸 🌱

                The release is available on:

        :package:@redhat-cloud-services/frontend-components-config/v/6.0.15📦

             :boom:This feature is brought to you by probot🚀

@nacho-bot nacho-bot added the released Pr has been released label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Once merged it will trigger bugfix release released Pr has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants