Hi. We are building a heavily-hybrid app, and large chunkes of content come from TWIG.
An example of it might look like this right now:
<custom-form inline-template>
{% for user in users %}
<label>{{ 'label'|trans({'name': user.name}) }}</label>
<input v-model="payload[{{ user.id }}]">
{% endfor %}
</custom-form>
We are at the stage when actually, doing props+serialization adds maintainability difficulties over decoupling benefits (it is not worth maintaing multiple translation layers between our server and client renderers).
However, now the problem is: I have to go to a completely different file (CustomForm.vue) in order to maintain the scripts:
Hi. We are building a heavily-hybrid app, and large chunkes of content come from TWIG.
An example of it might look like this right now:
We are at the stage when actually, doing props+serialization adds maintainability difficulties over decoupling benefits (it is not worth maintaing multiple translation layers between our server and client renderers).
However, now the problem is: I have to go to a completely different file (
CustomForm.vue
) in order to maintain the scripts:How could I solve this?
What I can think of:
However, I cannot quite execute it either way.
The problem with 1. is that I am transpiling JS through BABEL, so I would need Babel to somehow compile the JS inside a
<script>
tag in a twig file.Could 2. be somehow achieved? Somehow configure a TWIG loader for webpack to precompile?
Thank you for your answers.