Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
postcss-modules-local-by-default
Advanced tools
A CSS Modules transform to make local scope the default
The postcss-modules-local-by-default npm package is a PostCSS plugin that modifies CSS class names to be locally scoped by default. This is part of CSS Modules, which helps avoid class name collisions and ensures styles are encapsulated to specific components only. It rewrites all class names in CSS files to be scoped locally unless explicitly specified otherwise.
Local Scoping of Class Names
Automatically transforms global CSS class names into locally scoped names. This prevents class name collisions across different components or sections of a web application.
/* Input CSS */
.className {
color: red;
}
/* Output CSS after processing with postcss-modules-local-by-default */
._className_xkpkl_1 {
color: red;
}
Selective Global Scoping
Allows developers to selectively keep some class names global. This is useful for overriding styles or for styles that are meant to be consistent across various components.
/* Input CSS */
:global(.globalClassName) {
color: blue;
}
/* Output CSS remains unchanged */
.globalClassName {
color: blue;
}
Similar to postcss-modules-local-by-default, this package helps in scoping CSS class names locally. However, postcss-modules-scope provides more customizable options for generating scoped names, making it more flexible in projects that require a specific naming convention.
This package is part of the CSS Modules ecosystem and allows sharing values between CSS files, such as variables. While it doesn't handle scoping of class names, it complements postcss-modules-local-by-default by managing shared values, enhancing the modularity of CSS.
Transformation examples:
.foo { ... } /* => */ :local(.foo) { ... }
.foo .bar { ... } /* => */ :local(.foo) :local(.bar) { ... }
/* Shorthand global selector */
:global .foo .bar { ... } /* => */ .foo .bar { ... }
.foo :global .bar { ... } /* => */ :local(.foo) .bar { ... }
/* Targeted global selector */
:global(.foo) .bar { ... } /* => */ .foo :local(.bar) { ... }
.foo:global(.bar) { ... } /* => */ :local(.foo).bar { ... }
.foo :global(.bar) .baz { ... } /* => */ :local(.foo) .bar :local(.baz) { ... }
.foo:global(.bar) .baz { ... } /* => */ :local(.foo).bar :local(.baz) { ... }
$ npm install
$ npm test
$ npm run autotest
MIT
Mark Dalgleish, 2015.
2.0.6 - 2019-03-05
.\31 a2b3c { color: red }
)FAQs
A CSS Modules transform to make local scope the default
The npm package postcss-modules-local-by-default receives a total of 10,391,564 weekly downloads. As such, postcss-modules-local-by-default popularity was classified as popular.
We found that postcss-modules-local-by-default demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.