latte – template specific javascript

about a month ago

+
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

about a month ago

CZechBoY
Member | 3591
+
+1
-

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

about a month ago

dakur
Member | 44
+
+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)