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-cli
Advanced tools
The postcss-cli package is a command-line interface for PostCSS, a tool for transforming CSS with JavaScript plugins. It allows you to process CSS files using various PostCSS plugins directly from the command line.
Basic CSS Processing
This command processes the input CSS file (input.css) and outputs the transformed CSS to the specified output file (output.css).
postcss input.css -o output.css
Using Plugins
This command uses the 'autoprefixer' plugin to add vendor prefixes to the CSS rules in the input file and outputs the result to the specified output file.
postcss --use autoprefixer -o output.css input.css
Config File
This command uses a configuration file (postcss.config.js) to specify the plugins and options for processing the CSS file.
postcss -c postcss.config.js -o output.css input.css
Watch Mode
This command watches the input CSS file for changes and automatically processes it whenever it is modified, outputting the result to the specified output file.
postcss input.css -o output.css --watch
gulp-postcss is a Gulp plugin for PostCSS. It allows you to integrate PostCSS processing into your Gulp build pipeline. Compared to postcss-cli, gulp-postcss is more suitable for complex build processes where you are already using Gulp.
Webpack is a module bundler that can be configured to use PostCSS through loaders like 'postcss-loader'. It is more powerful and flexible than postcss-cli, making it suitable for larger projects with more complex build requirements.
grunt-postcss is a Grunt plugin for PostCSS. It allows you to use PostCSS in your Grunt build tasks. Similar to gulp-postcss, it is more suitable for projects that are already using Grunt for their build process.
Traditional CLI for postcss
npm install postcss-cli
postcss [options] [-o output-file|-d output-directory] [input-file]
--output|-o
Output file name. If no output file is specified, postcss
will write to stdout
, however plugins
that rely on output file location will not work properly.
Similarly, if no input file is specified, postcss
will read from stdin
.
Plugins that rely on input file location will not work properly.
--dir|-d
Output files location. Either --output
or --dir
option, but not both of them, need to be specified.
--dir
needs to be used if multiple input file is provided.
--use|-u
Plugin to be used. Multiple plugins can be specified. At least one is required.
--config|-c
JSON file with plugin configuration. Plugin names should be the keys.
{
"autoprefixer": {
"browsers": "> 5%"
},
"postcss-cachify": {
"baseUrl": "/res"
}
}
JS configuration can be used if functions are allowed as plugins parameters:
module.exports = {
"postcss-url": {
url: function(url) { return "http://example.com/" + url; }
},
autoprefixer: {
browsers: "> 5%"
}
};
Alternatively configuration options can be passed as --plugin.option
parameters.
--safe
Enable Safe Mode, in which PostCSS will try to fix CSS syntax errors.
-h, --help
Show help
Use autoprefixer as a postcss plugin pass parameters from a json file
postcss --use autoprefixer -c options.json -o screen.css screen.css
Use more than one plugin and pass config parameters
postcss --use autoprefixer --autoprefixer.browsers "> 5%" \
--use postcss-cachify --postcss-cachify.baseUrl /res \
-o screen.css screen.css
Use multiple plugins and multiple input files
postcss -u postcss-cachify -u autoprefixer -d build *.css
MIT
1.3.1 / 2015-05-03
FAQs
CLI for PostCSS
The npm package postcss-cli receives a total of 290,420 weekly downloads. As such, postcss-cli popularity was classified as popular.
We found that postcss-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.