Skip to content

feat: add the :global {} rule support #161

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

Merged
merged 10 commits into from
Jun 5, 2020
Merged

feat: add the :global {} rule support #161

merged 10 commits into from
Jun 5, 2020

Conversation

illright
Copy link
Contributor

@illright illright commented Jun 3, 2020

This implements the proposal discussed in Svelte RFCs: sveltejs/rfcs#22 (comment)

<style>
  .scoped-style {}
  
  :global {
    import 'global-stylesheet';
  
    .global-style {}
  }
</style>

This would allow for fine control of what parts of the stylesheet should be made global.

Tests

  • Run the tests tests with npm test or yarn test

@illright
Copy link
Contributor Author

illright commented Jun 3, 2020

As recently mentioned in the discussion of the RFC, maybe going with :global {} would be better than @global {} for compliance with CSS modules. Join the discussion in the RFC if you think this PR should be changed to use the colon notation instead.

@illright
Copy link
Contributor Author

illright commented Jun 3, 2020

I'm not sure why the build is failing. Can't reproduce the issue on Manjaro with the same Node version that is used in the CI. Besides, I didn't even edit the Less files. Any ideas?

@illright illright changed the title feat: add the @global {} rule support feat: add the :global {} rule support Jun 5, 2020
@kaisermann
Copy link
Member

Hey @illright 👋 First of all thanks for your pull request! I'll give it a look later today or tomorrow to see what's happening with the tests 😁

@kaisermann kaisermann self-assigned this Jun 5, 2020
@kaisermann
Copy link
Member

Done! Release in v3.9.0 🎉 . Thank you very much for your contribution 💯

@kaisermann kaisermann merged commit f95068d into sveltejs:master Jun 5, 2020
@kaisermann kaisermann added the enhancement New feature or request label Jun 5, 2020
@illright illright deleted the feature/global-at-rule branch June 5, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants