joeybaker / remapify

Alias directories for browserify
Other
117 stars 23 forks source link

Basepath of file vs. cwd #13

Closed gionkunz closed 10 years ago

gionkunz commented 10 years ago

Hi There,

I justed used your project as referenced by grunt-browserify. However, I found it a bit hard to get the feeling of how the alias is constructed together with expose. I have the following component structure in my project:

Then I use this configuration:

b.plugin(remapify, [{
  src: './src/main/components/**/scripts/*.js',
  expose: 'components'
}]);

And I'd expect remapify to create aliases for all my components components/comp1.js etc. Instead the alias is components/src/main/components/comp1/scripts/comp1.js.

From the documentation I can see the CWD will be replaced with expose. But wouldn't it be nicer that expose is just replacing the whole path of the file with expose? So that no matter what and where it's found, will be exposed as components/comp1.js etc.

Cheers Gion

joeybaker commented 10 years ago

I see what you're saying, and the confusion is understandable if you're coming from a grunt background. The issue is that remapify is a bit more agnostic of it's environment than grunt-browserify. It doesn't know it's working directory out of the box, so it needs to be told where to look. cwd: __dirname should do the trick for you I think?

Please close this issue if that solves it for you.

joeybaker commented 10 years ago

@gionkunz I haven't heard anything back, so I'm going to assume this is resolved. Please re-open with some more details if that's not the case!