Skip to content

Commit 71b66c1

Browse files
committed
Merge pull request #81 from tjallingt/master
Use browserify basedir as a fallback for rootDir
2 parents ce83315 + 42665df commit 71b66c1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ bundle.on('css stream', function (css) {
6363

6464
### Options:
6565

66-
- `rootDir`: absolute path to your project's root directory. This is optional but providing it will result in better generated classnames.
66+
- `rootDir`: absolute path to your project's root directory. This is optional but providing it will result in better generated classnames. css-modulesify will try to use the browserify `basedir` if `rootDir` is not specified, if both are not specified it will use the location from which the command was executed.
6767
- `output`: path to write the generated css. If not provided, you'll need to listen to the `'css stream'` event on the bundle to get the output.
6868
- `jsonOutput`: optional path to write a json manifest of classnames.
6969
- `use`: optional array of postcss plugins (by default we use the css-modules core plugins).

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = function (browserify, options) {
8888
options = options || {};
8989

9090
// if no root directory is specified, assume the cwd
91-
var rootDir = options.rootDir || options.d;
91+
var rootDir = options.rootDir || options.d || browserify._options.basedir;
9292
if (rootDir) { rootDir = path.resolve(rootDir); }
9393
if (!rootDir) { rootDir = process.cwd(); }
9494

0 commit comments

Comments
 (0)