I have a core application that I deploy to various clients and customize based on their specific requirements.
Let's say there is a foundational component comprising:
component-core.html
component-core.ts
Now, a client requests customization, prompting me to create duplicate files:
client-core-component1.html
client-core-component1.ts
In the configuration file angular.json, I make the necessary adjustments:
"fileReplacements": [
{
"replace": "src/components/component-core.html",
"with": "src/components/component-core-client1.html"
},
{
"replace": "src/components/component-core.ts",
"with": "src/components/component-core-client1.ts"
},
Subsequently, new functionalities are added, leading to code duplication across multiple client instances.
While it may seem impossible in HTML, is there a way to avoid duplicating all functions in component-core-client1.ts? Instead, could I import existing code and only add new functions as needed (utilizing just component-core-client1.html)? Or better yet, can I override functions from component-core.ts with those defined in component-core-client1.ts, falling back to the default if not present?
Explaining this request is complex, but it would greatly enhance my file organization capabilities.
Thank you