Socket
Socket
Sign inDemoInstall

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 2.1.1 to 2.2.0

6

History.md
2.2.0 / 2015-10-09
==================
* add support for --replace|-r - if used input files are replaced with generated output
* refactor support for custom syntax options
2.1.1 / 2015-10-08

@@ -3,0 +9,0 @@ ==================

53

index.js

@@ -20,8 +20,11 @@ var globby = require("globby");

.describe('d', 'Output directory')
.boolean('r')
.alias('r', 'replace')
.describe('r', 'Replace input file(s) with generated output')
.alias('s', 'syntax')
.describe('s', 'Custom syntax')
.describe('s', 'Alternative input syntax parser')
.alias('p', 'parser')
.describe('p', 'Custom syntax parser')
.describe('p', 'Alternative CSS parser')
.alias('t', 'stringifier')
.describe('t', 'Custom syntax stringifier')
.describe('t', 'Alternative output stringifier')
.alias('w', 'watch')

@@ -46,5 +49,14 @@ .describe('w', 'auto-recompile when detecting source changes')

}
if (argv.output && argv.dir && argv.replace) {
throw '`output file`, `output directory` and `replace` provided: please use either --output, --dir or --replace option only.';
}
if (argv.output && argv.dir) {
throw 'Both `output file` and `output directory` provided: please use either --output or --dir option.';
}
if (argv.output && argv.replace) {
throw 'Both `output file` and `replace` provided: please use either --output or --replace option.';
}
if (argv.dir && argv.replace) {
throw 'Both `output directory` and `replace` provided: please use either --dir or --replace option.';
}
return true;

@@ -66,4 +78,4 @@ })

}
if (inputFiles.length > 1 && !argv.dir) {
throw 'Please specify --dir [output directory] for your files';
if (inputFiles.length > 1 && !argv.dir && !argv.replace) {
throw 'Please specify either --replace or --dir [output directory] for your files';
}

@@ -82,2 +94,10 @@

var customSyntaxOptions = ['syntax', 'parser', 'stringifier']
.reduce(function(cso, opt) {
if (argv[opt]) {
cso[opt] = require(argv[opt]);
}
return cso;
}, Object.create(null));
var async = require('neo-async');

@@ -89,5 +109,2 @@ var fs = require('fs');

var processor = postcss(plugins);
var syntax = argv.syntax ? require(argv.syntax) : null;
var parser = argv.parser ? require(argv.parser) : null;
var stringifier = argv.stringifier ? require(argv.stringifier) : null;

@@ -118,2 +135,4 @@ if (argv.watch) {

output = path.join(argv.dir, path.basename(input));
} else if (argv.replace) {
output = input;
}

@@ -132,3 +151,3 @@ processCSS(processor, input, output, fn);

var opts = {
var options = {
from: input,

@@ -138,15 +157,7 @@ to: output

if (syntax) {
opts.syntax = syntax;
}
Object.keys(customSyntaxOptions).forEach(function(opt) {
options[opt] = customSyntaxOptions[opt];
});
if (parser) {
opts.parser = parser;
}
if (stringifier) {
opts.stringifier = stringifier;
}
var result = processor.process(css, opts);
var result = processor.process(css, options);
if (typeof result.then === 'function') {

@@ -153,0 +164,0 @@ result.then(onResult).catch(fn);

{
"name": "postcss-cli",
"version": "2.1.1",
"version": "2.2.0",
"description": "CLI for postcss",

@@ -5,0 +5,0 @@ "main": "index.js",

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

postcss [options] [-o output-file|-d output-directory] [input-file]
postcss [options] [-o output-file|-d output-directory|-r] [input-file]

@@ -33,5 +33,10 @@ #### `--output|-o`

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.
Output files location. Either `--output`, `--dir` or `--replace` option, but not all of them, need to be specified.
`--dir` or `--replace` needs to be used if multiple input file is provided.
#### `--replace|-r`
Replace input file(s) with generated output. Either `--output`, `--dir` or `--replace` option, but not all of them, need to be specified.
`--replace` or `--dir` needs to be used if multiple input file is provided.
#### `--use|-u`

@@ -38,0 +43,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