L. Heider
L. Heider

Reputation: 1819

Nx Angular Workspace: How to share the index.html between multiple apps?

I currently have 3 apps in my nx workspace. All of these are Angular applications, so they all have an index.html file in the app-name/src folder. As these apps will all be deployed to the same domain by using different "url-subsets" they use to have the exact same index.html (meta tags, fav icon etc.)

It's obvious I don't want them to be redundant in each app, but rather have a shared index.html.

How could this be done?

Upvotes: 4

Views: 1579

Answers (2)

L. Heider
L. Heider

Reputation: 1819

@Eweren's answer works!

starting the path to the lib with ./ like so:

"index": "./libs/name-of-lib/index.html"

I prefer @Eweren's answer, but yet there's another way to accomplish it by setting up fileReplacements for the index file in each project.

Upvotes: 0

Eweren
Eweren

Reputation: 277

This should work: You could try to change the path of the "index" property in the angular.json. So you have one index.html file in the root of your nx project and all apps have the index defined as "index.html" in the angular.json

Upvotes: 2

Related Questions