Categories
Vue Answers

How to fix conflict between templates of Twig and Vue.js?

Spread the love

Sometimes, we want to fix conflict between templates of Twig and Vue.js.

In this article, we’ll look at how to fix conflict between templates of Twig and Vue.js.

How to fix conflict between templates of Twig and Vue.js?

To fix conflict between templates of Twig and Vue.js, we can change the delimiters when we’re creating the Vue instance.

For instance, we write

new Vue({ delimiters: ['${', '}'] })

to set the template variable delimiters to be different from the default double curly braces in Vue 2.

In Vue 3, we write

Vue.createApp({ delimiters: ['${', '}'] })

to set the template variable delimiters to be different from the default double curly braces with Vue.createApp.

Conclusion

To fix conflict between templates of Twig and Vue.js, we can change the delimiters when we’re creating the Vue instance.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *