diff --git a/README.md b/README.md index 0212500..c5c8954 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ b.on('css stream', function (css) { - `after`: optional array of postcss plugins to run after the required css-modules core plugins are run. - `generateScopedName`: (API only) a function to override the default behaviour of creating locally scoped classnames. - `global`: optional boolean. Set to `true` if you want `css-modulesify` to apply to `node_modules` as well as local files. You can read more about it in the [browserify docs](https://github.com/substack/node-browserify/#btransformtr-opts). +- `filePattern`: optional regular expression string to specify css file names. (default: `\.css$`) ### Events - `b.on('css stream', callback)` The callback is called with a readable stream containing the compiled CSS. You can write this to a file. diff --git a/cmify.js b/cmify.js index 5247b86..1ad8294 100644 --- a/cmify.js +++ b/cmify.js @@ -10,14 +10,14 @@ function Cmify(filename, opts) { stream.Transform.call(this); - this.cssExt = /\.css$/; + this.cssFilePattern = new RegExp(opts.cssFilePattern || '\.css$'); this._data = ""; this._filename = filename; this._cssOutFilename = opts.cssOutFilename; } Cmify.prototype.isCssFile = function (filename) { - return this.cssExt.test(filename) + return this.cssFilePattern.test(filename) } Cmify.prototype._transform = function (buf, enc, callback) { diff --git a/index.js b/index.js index 93172bb..ddf48c8 100644 --- a/index.js +++ b/index.js @@ -101,6 +101,7 @@ module.exports = function (browserify, options) { var cssOutFilename = options.output || options.o; var jsonOutFilename = options.json || options.jsonOutput; transformOpts.cssOutFilename = cssOutFilename; + transformOpts.cssFilePattern = options.filePattern; // PostCSS plugins passed to FileSystemLoader var plugins = options.use || options.u;