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-critical-css
Advanced tools
This plugin allows you to define and output critical CSS using custom CSS properties.
npm install postcss-critical-css --save-dev
/* In foo.css */
.foo {
critical-selector: this;
border: 3px solid gray;
display: flex;
padding: 1em;
}
Will output:
/* In critical.css */
.foo {
border: 3px solid gray;
display: flex;
padding: 1em;
}
Note that in the above example, the selector is rendered as it is written in the
module. This may not be desireable, so you can alternatively identify the
selector you'd like to use in your critical.css
;
/* In foo.css */
.foo {
critical-selector: .custom-selector;
border: 3px solid gray;
display: flex;
padding: 1em;
}
Will output:
/* In critical.css */
.custom-selector {
border: 3px solid gray;
display: flex;
padding: 1em;
}
If you'd like to ouptut the entire scope of a module, including children, you can!
/* in foo.css */
.foo {
critical-selector: scope;
border: 3px solid gray;
display: flex;
padding: 1em;
}
.foo a {
color: blue;
text-decoration: none;
}
Will output:
/* In critical.css */
.foo {
border: 3px solid gray;
display: flex;
padding: 1em;
}
.foo a {
color: blue;
text-decoration: none;
}
And what if you need to output multiple critical CSS files (for example, if you have two different templates that do not share styles)? You can do that as well.
/* in foo.css */
.foo {
critical-selector: this;
critical-filename: secondary-critical.css;
border: 3px solid gray;
display: flex;
padding: 1em;
}
Will output:
/* In secondary-critical.css */
.foo {
border: 3px solid gray;
display: flex;
padding: 1em;
}
outputPath Path to which critical CSS should be output Default: current working directory
preserve Whether or not to remove selectors from primary CSS document once they've been marked as critical. This should prevent duplication of selectors across critical and non-critical CSS. WARNING: this is a destructive option and may break styles relying on the cascade! Default: true
minify Minify output CSS Default: true
FAQs
Generate critical CSS using PostCSS
We found that postcss-critical-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.