File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ all: clean lint test
33lint :
44 ./node_modules/.bin/jshint * .js
55
6- TESTS = opts source-maps source-maps-file stdout stdin config config-all config-wildcard js-config js-config-all invalid warning
6+ TESTS = opts source-maps source-maps-file stdout stdin config config-all config-wildcard js-config js-config-all invalid warning no-plugin
77
88
99DIFF = diff -q
@@ -83,6 +83,9 @@ test/build/invalid.css: test/in-force-error.css
8383test/build/warning.css : test/in-warning.css
8484 ./bin/postcss --use ./test/dummy-plugin -o $@ $< && echo Warning is OK here....
8585
86+ test/build/no-plugin.css : test/no-plugin.css
87+ ./bin/postcss ./test/no-plugin.css -o $@ && echo It works without plugins
88+
8689test/build/config.css : test/in.css
8790 ./bin/postcss -u postcss-url -c test/config.json -o $@ $<
8891 $(DIFF ) $@ $(subst build,ref,$@ )
Original file line number Diff line number Diff line change @@ -49,9 +49,6 @@ var argv = require("yargs")
4949 . help ( 'h' )
5050 . alias ( 'h' , 'help' )
5151 . check ( function ( argv ) {
52- if ( ! argv . use ) {
53- throw 'Please specify at least one plugin name.' ;
54- }
5552 if ( argv . _ . length && argv . input ) {
5653 throw 'Both positional arguments and --input option used for `input file`: please only use one of them.' ;
5754 }
@@ -104,8 +101,10 @@ var plugins = argv.use.map(function(name) {
104101 if ( local ) {
105102 var resolved = resolve . sync ( name , { basedir : process . cwd ( ) } ) ;
106103 plugin = require ( resolved ) ;
107- } else {
104+ } else if ( name ) {
108105 plugin = require ( name ) ;
106+ } else {
107+ return null ;
109108 }
110109 if ( name in argv ) {
111110 plugin = plugin ( argv [ name ] ) ;
@@ -136,7 +135,7 @@ var path = require('path');
136135var readFile = require ( 'read-file-stdin' ) ;
137136var path = require ( 'path' ) ;
138137var postcss = require ( 'postcss' ) ;
139- var processor = postcss ( plugins ) ;
138+ var processor = plugins [ 0 ] ? postcss ( plugins ) : postcss ( ) ;
140139var mkdirp = require ( 'mkdirp' ) ;
141140
142141// hook for dynamically updating the list of watched files
Original file line number Diff line number Diff line change 1+ body {
2+ margin : 0 ;
3+ }
You can’t perform that action at this time.
0 commit comments