Question

To load files in my theme, I use {{ theme:js file="bootstrap.min.js" }}. But what if I want to load something from a CDN like http://code.jquery.com/jquery-1.9.1.js.

I tried {{ theme:js file="http://code.jquery.com/jquery-1.9.1.js" }} but that errors out.

Ideas?

Was it helpful?

Solution

You can link to it directly as you would normally without using an actual "tag." For example take a look at this header partial from the base theme of Pyro 2.2:

https://github.com/pyrocms/pyrocms/blob/2.2/develop/addons/shared_addons/themes/base/views/partials/header.html#L33

(note this example is a remote css file but, the same can be done with js files etc.)

OTHER TIPS

Why would you do that?!

I wrote {{ theme:js }} to help people not need to think about where their files were. If you are trying to include http://code.jquery.com/jquery-1.9.1.js then you know where it is.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js" />

That is all you need to do. Don't overthink it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top