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

fix(core): replace scope placeholder globally #2071

Merged
merged 2 commits into from Jan 25, 2023

Conversation

chu121su12
Copy link
Collaborator

Fix #2068

I'd tag this as breaking since the replacement is now global while exported and being used in 2 other places:

.replace(regexScopePlaceholder, ' ')

const selector = _selector?.replace(regexScopePlaceholder, ' ') || _selector

@netlify
Copy link

netlify bot commented Jan 11, 2023

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit ad86d31
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/63d1156689f4f900085bdaeb
😎 Deploy Preview https://deploy-preview-2071--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@chu121su12 chu121su12 marked this pull request as ready for review January 11, 2023 06:41
@antfu
Copy link
Member

antfu commented Jan 22, 2023

LGTM, but I didn't get what is breaking.

Comment on lines 640 to 643
const regexScopeCheck = / \$\$ /
export const regexScopePlaceholder = / +\$\$ +/g
function applyScope(css: string, scope?: string) {
if (hasScopePlaceholder(css))
if (css.match(regexScopeCheck))
Copy link
Member

@antfu antfu Jan 22, 2023

Choose a reason for hiding this comment

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

export const regexScopePlaceholder = /\s\$\$\s+/g
export const hasScopePlaceholder = (css: string) => css.match(/\s\$\$\s/)

function applyScope(css: string, scope?: string) {
  if (hasScopePlaceholder(css))

Can't we do this?

@antfu antfu changed the title fix(core)!: replace scope placeholder globally fix(core): replace scope placeholder globally Jan 25, 2023
@antfu antfu enabled auto-merge (squash) January 25, 2023 11:47
@antfu antfu merged commit f2d6b6c into unocss:main Jan 25, 2023
@chu121su12 chu121su12 deleted the fix/scope-replacement branch February 23, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using multiple variants can be problematic
2 participants