Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Is there a way to change the working directory? #39

Open
arthur5005 opened this issue Dec 19, 2014 · 4 comments
Open

Is there a way to change the working directory? #39

arthur5005 opened this issue Dec 19, 2014 · 4 comments

Comments

@arthur5005
Copy link

Is there a way to change the working directory for where grunt-bower-concat looks for the .bowerc or bower_components ?

My Gruntfile and bower_components are in 2 different places.

I've tried (just for kicks)
expand: true
cwd: 'foo/bar'

Surprisingly it gave me a JavaScript exception (as a warning) when I tried that.
Running "bower_concat:dist" (bower_concat) task
Warning: Cannot call method 'indexOf' of undefined

@sapegin
Copy link
Owner

sapegin commented Dec 19, 2014

Not sure it’s possible right now. You can probably put .bowerrc into the directory with your Gruntfile.

@arthur5005
Copy link
Author

Good point. In hindsight, this would only be required if you have multiple bower_components directories that you want to target with one grunt file. I've found the .bowerrc at the root directory (and pointing it to the bower_components directory) solves my specific issue.

I tried a couple of things that yielded unexpected results though, like temporarily setting the grunt working directory to where the bower_components in a custom task with 'setBase'. This technique produced some unexpected and undocumented error.

So unless you're looking to support the multiple bower_components directories scenario, I think this is a non-issue. My apologies :).

Arthur.

@aleross
Copy link

aleross commented Aug 12, 2015

I ran into the scenario above where I have two bower_components folders in subdirectories, being targeted by a single Gruntfile. I run grunt prompt to determine which subdirectory I'm targeting. It's probably a rare use-case, but I wanted to mention it because being able to specify the bower_components directory would be helpful for this task.

@thepian
Copy link

thepian commented Aug 26, 2015

I don't see it as unusual. It is needed whenever you have bower.json in a subdirectory. Since bower is loaded as a submodule of grunt-bower-concat, it isn't possible to get to it.
Due to Grunts "principle" of not supporting package.json in a parent directory, you have to change the current working directory when loading tasks. Hence the cwd() read by bower will be the parent directory rather than the one with bower.json

Please support a cwd option in bowerOptions.

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

No branches or pull requests

4 participants