postcss-cli
Advanced tools
Comparing version 1.3.1 to 1.4.0
26
index.js
@@ -14,3 +14,3 @@ var argv = require("yargs") | ||
.describe('u', 'postcss plugin name (can be used multiple times)') | ||
.demand('u', 'Please specify at least one plugin name.') | ||
.alias('i', 'input') | ||
.alias('o', 'output') | ||
@@ -20,3 +20,3 @@ .describe('o', 'Output file (stdout if not provided)') | ||
.describe('d', 'Output directory') | ||
.requiresArg(['u', 'c', 'o', 'd']) | ||
.requiresArg(['u', 'c', 'i', 'o', 'd']) | ||
.boolean('safe') | ||
@@ -34,4 +34,4 @@ .describe('safe', 'Enable postcss safe mode.') | ||
.check(function(argv) { | ||
if (argv._.length > 1 && !argv.dir) { | ||
throw 'Please specify --dir [output directory] for your files'; | ||
if (argv._.length && argv.input) { | ||
throw 'Both positional arguments and --input option used for `input file`: please only use one of them.'; | ||
} | ||
@@ -45,2 +45,5 @@ if (argv.output && argv.dir) { | ||
if (!argv.use) { | ||
throw 'Please specify at least one plugin name.'; | ||
} | ||
if (!Array.isArray(argv.use)) { | ||
@@ -105,8 +108,15 @@ argv.use = [argv.use]; | ||
if (!argv._.length) { | ||
// use stdin if nothing else is specified | ||
argv._ = [undefined]; | ||
var inputs = argv._; | ||
if (!inputs.length) { | ||
if(argv.input) { | ||
inputs = Array.isArray(argv.input) ? argv.input : [argv.input]; | ||
} else { // use stdin if nothing else is specified | ||
inputs = [undefined]; | ||
} | ||
} | ||
if (inputs.length > 1 && !argv.dir) { | ||
throw 'Please specify --dir [output directory] for your files'; | ||
} | ||
async.forEach(argv._, function(input, fn) { | ||
async.forEach(inputs, function(input, fn) { | ||
var output = argv.output; | ||
@@ -113,0 +123,0 @@ if (argv.dir) { |
{ | ||
"name": "postcss-cli", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "CLI for postcss", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,3 +32,4 @@ [![Build Status](https://img.shields.io/travis/code42day/postcss-cli.svg)](http://travis-ci.org/code42day/postcss-cli) | ||
Plugin to be used. Multiple plugins can be specified. At least one is required. | ||
Plugin to be used. Multiple plugins can be specified. At least one is required unless specified | ||
within config file. | ||
@@ -64,2 +65,18 @@ #### `--config|-c` | ||
Note that command-line options can also be specified in the config file: | ||
````json | ||
{ | ||
"use": ["autoprefixer", "postcss-cachify"], | ||
"input": "screen.css", | ||
"output": "bundle.css", | ||
"autoprefixer": { | ||
"browsers": "> 5%" | ||
}, | ||
"postcss-cachify": { | ||
"baseUrl": "/res" | ||
} | ||
} | ||
```` | ||
### `--safe` | ||
@@ -66,0 +83,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8104
6
121
109