<ev:javascript />
Also
<ev:js />
,
add JavaScript files to your template manually when you don't want to, or cannot use automated JavaScript
loading available to theme templates.
If <ev:javascript> seems like it's a bit too long, don't worry so did we, you can
also use
<ev:js>instead.
Attributes
<ev:javascript> accepts any attributes available to <script> tags, plus the following:
priority
high | normal | low
Default priority is NORMAL. When you include a JavaScript file you have a choice
as to which block it renders in. Priority corresponds to the order of load and not the importance of
the file. In fact the importance of the file is almost the reverse of priority so variables in the global
namespace of a LOW priority JavaScript file will overwrite the HIGH priority
namespace. But, of course
HIGH priority files load first, so I guess it depends on your perspective.
<html>
<head>
<!-- HIGH priority JavaScript files -->
</head>
<body>
...
<!-- NORMAL priority JavaScript files -->
<!-- LOW priority JavaScript files -->
</body>
</html>
|
src
We've replaced the src attribute for <script> tags with our own handler because it allows us to do
some pretty cool stuff. Let's take the following example:
<!--You write -->
<ev:js src="~/theme/js/script.js" />
In development mode your URL is converted into the account path for the current theme and appends a version number. You don't
need to worry about the version of your file or the name of your theme as these are calculated on-the-fly.
<!-- Evance renders -->
<script src="/portal/public/1234/theme/zero/js/script.js?v=1234"></script>
In production mode we do everything above, plus we convert the URL into the CDN path for the account and minify your script.
This removes the arduous task of minifying your code every time you change it.
<!-- Evance renders -->
<script src="//cdn.evance.it/portal/public/1234/theme/zero/js/script.js?v=1234"></script>
|