File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ module.exports = function (source, map) {
4343 }
4444
4545 var plugins ;
46+ var exec ;
4647 if ( typeof options === 'undefined' ) {
4748 plugins = [ ] ;
4849 } else if ( Array . isArray ( options ) ) {
@@ -52,6 +53,7 @@ module.exports = function (source, map) {
5253 opts . stringifier = options . stringifier ;
5354 opts . parser = options . parser ;
5455 opts . syntax = options . syntax ;
56+ exec = options . exec ;
5557 }
5658 if ( params . pack ) {
5759 plugins = options [ params . pack ] ;
@@ -69,11 +71,14 @@ module.exports = function (source, map) {
6971 if ( params . stringifier ) {
7072 opts . stringifier = require ( params . stringifier ) ;
7173 }
74+ if ( params . exec ) {
75+ exec = params . exec ;
76+ }
7277
7378 var loader = this ;
7479 var callback = this . async ( ) ;
7580
76- if ( params . parser === 'postcss-js' ) {
81+ if ( params . parser === 'postcss-js' || exec ) {
7782 source = this . exec ( source , this . resource ) ;
7883 }
7984
Original file line number Diff line number Diff line change 1+ var postcssJs = require ( 'postcss-js' ) ;
2+
3+ var style = {
4+ a : {
5+ color : 'green'
6+ }
7+ } ;
8+
9+ module . exports = postcssJs . parse ( style ) ;
Original file line number Diff line number Diff line change @@ -31,6 +31,13 @@ describe('postcss-loader', function () {
3131 expect ( css ) . to . eql ( 'a {\n color: red\n}' ) ;
3232 } ) ;
3333
34+ it ( 'processes CSS with exec' , function ( ) {
35+ var css = require ( '!raw-loader!' +
36+ '../?exec!' +
37+ './cases/exec.js' ) ;
38+ expect ( css ) . to . eql ( 'a {\n color: green\n}' ) ;
39+ } ) ;
40+
3441 it ( 'inlines map' , function ( ) {
3542 var css = require ( '!raw-loader!../?sourceMap=inline!./cases/style.css' ) ;
3643 expect ( css ) . to . include ( '/*# sourceMappingURL=' ) ;
You can’t perform that action at this time.
0 commit comments