2

Is there any way to pass a variable from gulpfile to front-end script?

I'm trying to issue a command line deployment, and have a variable change depending on if I run: "gulp build --development" or "gulp build --production".

The command would deploy a version of the front-end script to pull data from test url or pull from production url.

Note: I'm using gulp-connect as my server.

0

1 Answer 1

1

The first idea how to do it. Use yargs package to take a flag from command line, next use gulp-if combined with gulp-replace to proper inject server address to one of your configuration js file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.