@@ -121,6 +121,13 @@ var customSyntaxOptions = ['syntax', 'parser', 'stringifier']
121121 return cso ;
122122 } , Object . create ( null ) ) ;
123123
124+
125+ var mapOptions = argv . map ;
126+ // treat `--map file` as `--no-map.inline`
127+ if ( mapOptions === 'file' ) {
128+ mapOptions = { inline : false } ;
129+ }
130+
124131var async = require ( 'neo-async' ) ;
125132var fs = require ( 'fs' ) ;
126133var readFile = require ( 'read-file-stdin' ) ;
@@ -173,15 +180,10 @@ function compile(input, fn) {
173180 output = input ;
174181 }
175182
176- var map = typeof argv . map !== 'undefined' ? argv . map : false ;
177- if ( map === 'file' ) {
178- map = { inline :false } ;
179- }
180-
181- processCSS ( processor , input , output , map , fn ) ;
183+ processCSS ( processor , input , output , fn ) ;
182184}
183185
184- function processCSS ( processor , input , output , map , fn ) {
186+ function processCSS ( processor , input , output , fn ) {
185187 function doProcess ( css , fn ) {
186188 function onResult ( result ) {
187189 if ( typeof result . warnings === 'function' ) {
@@ -192,14 +194,17 @@ function processCSS(processor, input, output, map, fn) {
192194
193195 var options = {
194196 from : input ,
195- to : output ,
196- map : map
197+ to : output
197198 } ;
198199
199200 Object . keys ( customSyntaxOptions ) . forEach ( function ( opt ) {
200201 options [ opt ] = customSyntaxOptions [ opt ] ;
201202 } ) ;
202203
204+ if ( typeof mapOptions !== 'undefined' ) {
205+ options . map = mapOptions ;
206+ }
207+
203208 var result = processor . process ( css , options ) ;
204209
205210 if ( typeof result . then === 'function' ) {
0 commit comments