New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cookie_gg/postcss-global-scope

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cookie_gg/postcss-global-scope

PostCSS plugin that supports global scoping in nested rules

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-global-scope

PostCSS plugin that supports global scoping in nested rules.

Install

npm i -D postcss @cookie_gg/postcss-global-scope
# or
yarn add -D postcss @cookie_gg/postcss-global-scope

Usage

You have to use this plugin with postcss-nested and set it after postcss-global-scope.

module.exports = {
  ...
  plugins: [
    // other plugins...
    ['@cookie_gg/postcss-global-scope', {
        skip: "-",
        classes: ["dark", "light"]
      }
    ]
  ]
  ...
}
/* before */
main {
  h1 {
    :global(.dark) & {
      color: blue;
    }
  }
}

/* after */
[class="dark"] main h1 {
  color: blue;
}

Options

skip: String

default: '-'

Define the skip syntax used to ignore portions of the shorthand.

classes: Array<String>

default: 'undefined'

You can use global scope on short type libe below.

/* before */
main {
  h1 {
    color: white ^ black;
  }
}

/* after */
[class*="dark"] main h1 {
  color: dark;
}
[class*="light"] main h1 {
  color: white;
}

cssModule: Boolean

default: 'false'

If you use this plugin with css module, you don't need to use the function to parse :global(class).

strictScope: Boolean

default: 'false'

If you set this option to true, global seclector will be strict like below.

/* before */
main {
  h1 {
    color: white ^ black;
  }
}

/* after */
[class="dark"] main h1 {
  color: dark;
}
[class="light"] main h1 {
  color: white;
}

Keywords

FAQs

Package last updated on 30 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc