samedi 27 juin 2015

How to load a component file just once in VoltRb

I have a component that I only want to load once in my Volt project. Loading more than once will cause problems, similarly to loading the OpalRb library more than once. To clarify, I am loading this component in a view file, and it keeps getting loaded because the line loading the component keeps getting called every time the page gets hit:

{{ if condition }}
{{   require 'component/lib/file' # this line keeps getting called }}
{{ end }}

How do I set up my code so that I can load a component only once?

Aucun commentaire:

Enregistrer un commentaire