@@ -37,32 +37,36 @@ module.exports = function (browserify, options) {
37
37
if ( typeof plugins === 'string' ) {
38
38
plugins = [ plugins ] ;
39
39
}
40
+ }
40
41
41
- plugins = plugins . map ( function requirePlugin ( name ) {
42
- // assume functions are already required plugins
43
- if ( typeof name === 'function' ) {
44
- return name ;
45
- }
42
+ var postcssAfter = options . postcssAfter || options . after || [ ] ;
43
+ plugins = plugins . concat ( postcssAfter ) ;
46
44
47
- var plugin = require ( require . resolve ( name ) ) ;
45
+ // load plugins by name (if a string is used)
46
+ plugins = plugins . map ( function requirePlugin ( name ) {
47
+ // assume functions are already required plugins
48
+ if ( typeof name === 'function' ) {
49
+ return name ;
50
+ }
48
51
49
- // custom scoped name generation
50
- if ( name === 'postcss-modules-scope' ) {
51
- options [ name ] = options [ name ] || { } ;
52
- if ( ! options [ name ] . generateScopedName ) {
53
- options [ name ] . generateScopedName = createScopedNameFunc ( plugin ) ;
54
- }
55
- }
52
+ var plugin = require ( require . resolve ( name ) ) ;
56
53
57
- if ( name in options ) {
58
- plugin = plugin ( options [ name ] ) ;
59
- } else {
60
- plugin = plugin . postcss || plugin ( ) ;
54
+ // custom scoped name generation
55
+ if ( name === 'postcss-modules-scope' ) {
56
+ options [ name ] = options [ name ] || { } ;
57
+ if ( ! options [ name ] . generateScopedName ) {
58
+ options [ name ] . generateScopedName = createScopedNameFunc ( plugin ) ;
61
59
}
60
+ }
62
61
63
- return plugin ;
64
- } ) ;
65
- }
62
+ if ( name in options ) {
63
+ plugin = plugin ( options [ name ] ) ;
64
+ } else {
65
+ plugin = plugin . postcss || plugin ( ) ;
66
+ }
67
+
68
+ return plugin ;
69
+ } ) ;
66
70
67
71
// keep track of css files visited
68
72
var filenames = [ ] ;
0 commit comments