sdsd
sdsd

Reputation: 517

How can i change angular app name without making new one?

I create angular app with

ng new angular-excel-example

so when the app is generated, it makes - angular-excel-example to be used everywhere.

For example

package.json file - name property inside

 {
  "name": "angular-excel-example",
  "version": "0.0.0",
  "scripts": {
...
}

angular.json file

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular-excel-example": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/angular-excel-example",
...

is there anyway that i can change the app name dynamicaly - everywhere without breaking something - for example the configuration in angular.json file etc.

from angular-excel-example to some-new-name

Upvotes: 0

Views: 1305

Answers (2)

Khashayar Pakkhesal
Khashayar Pakkhesal

Reputation: 434

untill now there is no command in angular cli to replace name of project the most effient way is to search the name in whole project and replace it

Upvotes: 0

Milan Tenk
Milan Tenk

Reputation: 2705

I suggest using the "find and replace in every file" feature in the code editor. This way every occurrence of angular-excel-example is found and it can be checked before it is changed to some-new-name.

As an example in Visual Studio Code press CTRL+SHIFT+F and open the "replace" part with the arrow icon and check each change below at the listed files. (I would not go for "replace all", as it may replace some places that should not be touched.)

enter image description here

Upvotes: 3

Related Questions