0

This question is about angular-cli usage.

Is it possible to specify the project folder for running ng commands?

For example:

$ ng build /home/fadc80/my-first-angular-cli-project

Additionally...

Is it possible to specify the output folder too?

For example:

$ ng build /home/fadc80/my-first-angular-cli-project ./build

Thanks!

2 Answers 2

3

It's not possible directly to build a cli project when you're not inside the projects folder.

Angular cli quits with a useful error message here:

You have to be inside an angular-cli project in order to use the build command.

But to achieve what you want to do you can go this way:

CURRENT_DIR=$(pwd) && \
cd /home/fadc80/my-first-angular-cli-project && \
ng build -o $CURRENT_DIR/build && \
cd $CURRENT_DIR
Sign up to request clarification or add additional context in comments.

Comments

1

NOTE: This answer does not answer the actual question, but leaving it hear as the build param information may be helpful to those searching and ending up here.

In the file angular-cli.json under apps is a property called outDir which has a default value of dist.

You can customize that value to place the output of your build to wherever makes the most sense for your project.

Furthermore; you can specify the value via the command line with the output-path option:

ng build --output-path build

or via the shortcut o

ng build -o build

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.