Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README shows invalid setup information #34

Closed
taylorhakes opened this issue Mar 15, 2015 · 1 comment
Closed

README shows invalid setup information #34

taylorhakes opened this issue Mar 15, 2015 · 1 comment

Comments

@taylorhakes
Copy link

Readme shows

var browserify = require('browserify')
  , remapify = require('remapify')
  , b = browserify(__dirname)

b.plugin(remapify, [
  {
    src: './client/views/**/*.js' // glob for the files to remap
    , expose: 'views' // this will expose `__dirname + /client/views/home.js` as `views/home.js`
    , cwd: __dirname // defaults to process.cwd()
    , filter: function(alias, dirname, basename) { // customize file names
      return path.join(dirname, basename.replace('foo', 'bar'))
    }
  }
])

b.bundle()

That information is incorrect. It should be

b.plugin(remapify, [
  {
    src: './client/views/**/*.js' // glob for the files to remap
    , expose: 'views' // this will expose `__dirname + /client/views/home.js` as `views/client/views/home.js`
    , cwd: __dirname // defaults to process.cwd()
    , filter: function(alias, dirname, basename) { // customize file names
      return path.join(dirname, basename.replace('foo', 'bar'))
    }
  }
])

The comment on the expose parameter now reflects what actually happens.

In order to expose views/home.js it should be

b.plugin(remapify, [
  {
    src: '**/*.js' // glob for the files to remap
    , expose: 'views' // this will expose `__dirname + /client/views/home.js` as `views/client/views/home.js`
    , cwd: './client/views'
    , filter: function(alias, dirname, basename) { // customize file names
      return path.join(dirname, basename.replace('foo', 'bar'))
    }
  }
])

Notice the change to cwd and src. I am not sure what caused this change, but it took a while for me to debug the cause.

Unfortunately, there is a related issue #33 that causes the files to be pointing at the wrong location.

@taylorhakes
Copy link
Author

Closing as duplicate of #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant