Skip to content

Use multiple templates for Native Script directives and for web (html / angular mat design) #10688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
mattiLeBlanc opened this issue Feb 4, 2025 · 1 comment
Labels

Comments

@mattiLeBlanc
Copy link

Is your feature request related to a problem? Please describe.

Hi,
I have keeping an eye on Nativescript for a while, starting around the time when you had a 2 templates solution, a HTML template for web and a NS template for Native script.
With the new version released (2 years ago) it is now all done in the HTML template.

I am missing tutorial or instruction page how to do this 2 layout setup for web (using angular material design) and native script directives?
Or do I just have to do an @if statement in my template for native and non native?

Describe the solution you'd like

Support for 2 templates, Native Script and HTML/Web so I can maintain one code base

Describe alternatives you've considered

use @if statement in HTML template.

Anything else?

Keep up the good work!

Please accept these terms

@mattiLeBlanc mattiLeBlanc added the feature-pending-triage A new feature request pending triage to confirm validity. label Feb 4, 2025
@NathanWalker
Copy link
Contributor

NathanWalker commented Feb 4, 2025

Hi @mattiLeBlanc thanks! This is always an interesting topic. Technically, yes you can have split templates (.web.html, .anything.html) and configured with webpack loader to handle them, for example this older approach:
https://old.docs.nativescript.org/angular/code-sharing/intro

The key reason we've generally steered away from this is because in practice this leads to quite a number of static analysis and IDE issues. Technically it's possible but not sure the pros outweigh the benefits you get from a well architected workspace, eg: https://nstudio.io/blog/nx-javascript-is-dead

Let us know your thoughts.

@NathanWalker NathanWalker added question and removed feature-pending-triage A new feature request pending triage to confirm validity. labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants