[Building Sakai] Javascript Libraries

Matthew Jones matthew at longsight.com
Mon Jan 13 08:49:59 PST 2014


I remember seeing a good tip for using a CDN and then having a fallback to
the local version (if the CDN isn't accessible of if you're offline)

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
"></script>
<script>!window.jQuery && document.write('<script
src="js/jquery-1.7.2.min.js"><\/script>')</script>

Similar to here [1], but that require.js example looks even cooler and is
more flexible with fallback libs.

[1]
http://www.hanselman.com/blog/CDNsFailButYourScriptsDontHaveToFallbackFromCDNToLocalJQuery.aspx


On Mon, Jan 13, 2014 at 11:39 AM, Charles Severance <csev at umich.edu> wrote:

>
> On Jan 13, 2014, at 11:10 AM, Aaron Zeckoski <azeckoski at unicon.net> wrote:
>
> It would be better to refer to the CDN version rather than putting
> something in our code that changes fairly often. This is the current
> one but it could be out of date the next time someone reads this
> thread:
> http://code.jquery.com/jquery-migrate-1.2.1.js
> -AZ
>
>
> Thanks - I will use 1.2.1 in the portal markup:
>
> https://jira.sakaiproject.org/browse/SAK-25505
>
> It is a mistake to hard-code a CDN URL into our velocity files.   But...
>   Sakai-10 already has the capability of putting virtually all of its
> static files up on a CDN with a few property settings.  It even has a way
> to force a reload of a new version of any file from the CDN.
>
> From https://jira.sakaiproject.org/browse/SAK-23628 :
>
> Introduce three new properties:
>
> # No trailing slash on the path
> portal.cdn.path=http://nightly2.sakaiproject.org:8085
> portal.cdn.version=12345
> portal.cdn.expire=10
>
> The path is a path to a CDN host that replicates your /portal and /library
> at a minimum. This should not have a trailing slash. If you are using
> skin.repo, you should prefix skin.repo with the URL of the CDN.   All the
> parameters are optional.
>
> ----
>
> I think that it is better - especially for the large hosters of Sakai to
> have full control over the CDN use.  The problem to solve with that each
> Sakai school may need to update files in their CDN to fix a problem, etc.
> SO using one CDN to rule them all would be a mistake IMHO...
>
> And the fun contnues if we couple these new properties with Earle's
> proposal to make it easy to change properties without a reboot:
>
> https://confluence.sakaiproject.org/display/~ern/StoredConfigService
>
> It can be an awesome CDN party for Sakai-10.  (happy dance)
>
> /Chuck
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20140113/d3aabd67/attachment.html 


More information about the sakai-dev mailing list