Daniel Brown
Daniel Brown

Reputation: 3062

Parent directory's gulpfile forces working directory change despite local gulpfile

I am developing a website that uses gulp to assist with development. I have a structure that looks similar to:

When in the directory for Zurb's "Foundation for Emails", if I attempt to run any of the following:

PowerShell says: "Changing working directory" and then runs the default gulp task in my Main Project folder. This does not happen when I run gulp commands from my UI Toolkit Folder.

However, if I delete the gulpfile.js in my Main Project Folder, all three of those commands work as expected. What's happening? How can I make these commands work with a gulpfile.js file in its parent's directory?

Upvotes: 0

Views: 367

Answers (1)

Sven Schoenung
Sven Schoenung

Reputation: 30564

Open package.json in your Foundaton For Emails folder and add the --gulpfile gulpfile.babel.js option to all of your npm scripts:

"scripts": {
  "start": "gulp --gulpfile gulpfile.babel.js",
  "build": "gulp --gulpfile gulpfile.babel.js --production",
  "zip": "gulp --gulpfile gulpfile.babel.js zip --production",
  "litmus": "gulp --gulpfile gulpfile.babel.js litmus --production"
},

This forces gulp to use the correct gulpfile instead of traversing the directory hierarchy upwards.

Upvotes: 1

Related Questions