Skip to content

Proposal: Support default custom output path #817

Closed

Description

@JonCubed

Problem:
Currently there is no official support for setting a default custom path. This can be important for those that have different project structures or use a different server to host angular2 such as asp.net core which expects static files to be in a folder called wwwroot/.

There is also not a consistent way to unofficially set a default value for custom output path. For ng buld and ng serve as they are still just the default commands in ember cli you can create a .ember-cli file with the following and it will work

{
    "output-path": "wwwroot/"
}

However, for ng test it has the output folder hard-coded to dist/ and as it is, as an add-on command would not use .ember-cli

Proposal:

I was only able to find three commands that use an output-path flag, build, serve, test. The following are what I think would need to change or be completed to support this feature.

  • General
    • Support output path in angular-cli.json as a sub property of defaults. Would probably be called outputPath to match the cli flag output-path and the format in angular-cli.json already. Would look something like:

      {
          "defaults": {
              "outputPath": "wwwroot/"
         }
      }
      

      _Required change:_ Update angular-cli.json schema

  • Test command
    • Remove hard-coded output path and instead retrieve it from

      _Required change:_ Use this.project.ngConfig to get default settings and use it instead to construct buildOptions

    • Add output-path flag to be consistent with other commands.
      _Required change:_ Add another option to availableOptions

  • Build Command
  • Serve Command

Note: As I have told @hansl I am willing to go through the design process and work on this.

Activity

  1. JonCubed commented on May 18, 2016

    @JonCubed
    ContributorAuthor

    other use cases:

  2. JonCubed commented on Jun 6, 2016

    @JonCubed
    ContributorAuthor

    @filipesilva @hansl what is the next step? Design docs or can I start working on this?

  3. filipesilva commented on Jun 7, 2016

    @filipesilva
    Contributor

    @JonCubed you're most welcome to make a PR for this functionality, make sure to add tests that verify it works as well.

  4. JonCubed commented on Jun 9, 2016

    @JonCubed
    ContributorAuthor

    @filipesilva sure no problems

  5. filipesilva commented on Oct 9, 2016

    @filipesilva
    Contributor

    Implemented as outDir in angular-cli.json currently. See #1109 (comment) also.

  6. rahul-winner commented on Feb 8, 2017

    @rahul-winner

    Neither of option to create custom distribution folder is working for me. I tried following

    ng build --outDir=customDist
    ng build --output-path=customDist
    ng build --outDir customDist
    ng build --output-path customDist

    nothing worked :(

    Could anyone please help me out.

    Thanks. Rahul

  7. JonCubed commented on Feb 9, 2017

    @JonCubed
    ContributorAuthor

    @rahul-winner looking at build.ts ng build --output-path customDist should work. Alternatively if you want it to be a default and not have to use the --output-path flag you can use --source-dir with ng new or ng init commands

  8. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Sep 6, 2019
  10. added a commit that references this issue on Jul 14, 2026
    93055f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussioneffort1: easy (hours)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions