youtpout
youtpout

Reputation: 135

angular-cli rename index on build

I want to rename the index.html on dist folder, how i can do that with angular cli on ng build --prod command.

Let me explain why I want to do that, it's for integrate my html page on index.php page, if I don't do that the server reply index.html before index.php and I can't configure the server for launch index.php first.

Thanks for the reply.

Upvotes: 3

Views: 5000

Answers (2)

stephan.peters
stephan.peters

Reputation: 1107

Another possibility if you don't control the name of the input file is like this:

"index": {
   "input": "./node_modules/example/index123.html",
   "output": "index.html"
}

In my case this was needed because I work for a customer where all applications are using the same index html template in a node_modules package.

Upvotes: 1

Yakov Fain
Yakov Fain

Reputation: 12376

  1. Rename the file index.html to index123.html in the src dir of your project

  2. In the file angular-cli.json modify the index property to look like this:

    "index": "index123.html"

The ng build command will copy the file index123.html into the dist dir.

Upvotes: 9

Related Questions