Skip to content

Allow use of <template> within template #26

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

Closed
wants to merge 2 commits into from
Closed

Allow use of <template> within template #26

wants to merge 2 commits into from

Conversation

yassilah
Copy link

@yassilah yassilah commented Jun 30, 2019

Currently, if I use a template tag within my main <template native|web>, the regex pattern will stop at the first closing template and the compiler will throw an error. I have found a way around it by adding a positive lookahead for a starting <template native|web>. If none is found, it falls back to the current pattern. I don't know if that's the most elegant way to do it but at least it works :)

@jawa-the-hutt
Copy link
Collaborator

Can you give a short example of a what you are doing to get this error to show up? I've done some basic testing and can't get the compiler to throw an issue. I'd like to be able to reproduce before I merge this.

@yassilah
Copy link
Author

yassilah commented Sep 2, 2019

Hi!

If i recall, you only need to add a template tag within the "main" template tag, e.g.:

<template web>
    <div>
        <template v-if="someCondition">
            <p>Something</p>
            <button>My button</button>
        </template>
        <template v-else>
            <p>Something else</p>
            <button>My other button</button>
        </template>
    </div>
</template>

<template native>
    <StackLayout>
        <template v-if="someCondition">
            <Label text="Something"/>
            <Button text="My button"/>
        </template>
        <template v-else>
            <Label text="Something else"/>
            <Button text="My other button"/>
        </template>
    </StackLayout>
</template>

@jawa-the-hutt
Copy link
Collaborator

I'm going to reject the PR as I could not reproduce this. However, I have left your regex statement in v0.2.0 as commented out in case we need to revisit this.

Try 0.2.0 and see if this still happens. It may very well happen for you, but in my test, I could not get any error to come up. This may be because with with 0.2.0, we are updating everything to Nativescript 6.1 and more importantly, to NS-Vue 2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants