Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [includejs]

The tag has no usage guidance.

1
vote
0answers
30 views

Avoiding includeJsFile, includeJS from caching

In my template, I have an includeJSFile that loads properly on the first load, but disappears on subsequent loads. The includeJSFile is outside the caching tags, so I'm not sure why this is still ...
1
vote
1answer
34 views

includeJs not consistently working

Using Craft 2 and I have a Matrix Block which can contain a carousel item, which uses JS/jQuery. Because the content editor can add multiple instances of this Matrix Block I can’t set up these ...
1
vote
1answer
332 views

Simplify Twig/JS loop code

Can any help simplify this js/twig code? The code links to some tabs that show floorplans of the property being sold. The specified aria-controls refers to a supertable field called floorLevel that ...
1
vote
1answer
212 views

Pass Craft field object to JavaScript function

I need to pass an entire Craft object into a JavaScript function. I followed the instructions in this post, however this only covers passing in a string. {% includeJsFile "/js/homepage.js" %} {% set ...
3
votes
3answers
626 views

Can you set async defer when using {% includeJsFile %}?

Is there a way to set async defer on a <script> tag with the built in: {% includeJsFile %} It's for Google Maps e.g.: <script src="https://maps.googleapis.com/maps/api/js?key=...
4
votes
2answers
757 views

how to includeJsFile in head instead of body

I am using this code to include a js file, but it adds to the <body>: {% includeJsFile '/path/script.min.js' %} I need to add it to the <head> instead, how can I do?
1
vote
1answer
474 views

minify javascript with includeJS

If i include javascript in a template using: {% set myJS %} //some JS in here {% endset %} {% includeJS myJS %} Is there a way to minify the javascript that gets output on the page? I had a look at ...