latte – template specific javascript

+
0
-

I have some javasript which will apply only to a single template.
Is this best in it's own block, or what is best practice for this sort of code in nette/latte?

K

CZechBoY
Member | 3608
+
+1
-

I would add specific class to <body> and handle this in js bundle

dakur
Member | 493
+
+1
-

Yes, we define blocks in our application, like you said, for few years and there was no problem with it. Like so:

Template:

<script n:block="scripts">
  whatever()
</script>

Layout:

{block scripts /}

Last edited by dakur (2020-07-11 10:46)