Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-cli

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-cli - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

53

index.js

@@ -7,3 +7,5 @@ var argv = require("yargs")

'Pass plugin parameters in plugin.option notation')
.demand(1, 'Please specify input file.')
.example('postcss -u postcss-cachify -u autoprefixer -d build *.css',
'Use multiple plugins and multiple input files')
.demand(1, 'Please specify at least one input file.')
.config('c')

@@ -17,4 +19,5 @@ .alias('c', 'config')

.describe('o', 'Output file')
.demand('o', 'Please specify output file.')
.requiresArg(['u', 'c', 'o'])
.alias('d', 'dir')
.describe('d', 'Output directory')
.requiresArg(['u', 'c', 'o', 'd'])
.boolean('safe')

@@ -32,2 +35,14 @@ .describe('safe', 'Enable postcss safe mode.')

.wrap()
.check(function(argv) {
if (argv._.length > 1 && !argv.dir) {
throw 'Please specify --dir [output directory] for your files';
}
if (argv.output && argv.dir) {
throw 'Both `output file` and `output directory` provided: please use either --output or --dir option.';
}
if (!argv.output && !argv.dir) {
throw 'Please specify --output [output file name] or --dir [out files location]';
}
return true;
})
.argv;

@@ -45,3 +60,3 @@

} else {
plugin = plugin.postcss;
plugin = plugin.postcss || plugin();
}

@@ -51,19 +66,23 @@ return plugin;

var fs = require('fs');
var input = argv._[0];
var output = argv.output;
var css = fs.readFileSync(input, 'utf8');
var path = require('path');
var postcss = require('postcss');
var processor = postcss(plugins);
var result = processor.process(css, {
safe: argv.safe,
from: input,
to: output
});
function process(processor, input, output) {
var css = fs.readFileSync(input, 'utf8');
var result = processor.process(css, {
safe: argv.safe,
from: input,
to: output
});
fs.writeFileSync(output, result.css);
}
fs.writeFileSync(output, result.css);
argv._.forEach(function(input) {
var output = argv.output;
if(!output) {
output = path.join(argv.dir, path.basename(input));
}
process(processor, input, output);
});
{
"name": "postcss-cli",
"version": "0.3.0",
"version": "1.0.0",
"description": "CLI for postcss",

@@ -21,3 +21,3 @@ "main": "index.js",

"postcss": "^4.0.6",
"yargs": "pirxpilot/yargs#3.5.4-postcss-cli"
"yargs": "^3.6.0"
},

@@ -24,0 +24,0 @@ "devDependencies": {

@@ -19,4 +19,9 @@ [![Build Status](https://img.shields.io/travis/code42day/postcss-cli.svg)](http://travis-ci.org/code42day/postcss-cli)

Output file name - required
Output file name
#### `--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`

@@ -75,2 +80,6 @@

Use multiple plugins and multiple input files
postcss -u postcss-cachify -u autoprefixer -d build *.css
## Licence

@@ -77,0 +86,0 @@

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