My Cart (0)  |  My Orders  |  My Downloads  |  My Auction  |  My Account  |  Help


Login |Register        Search

Import JavaScript Libraries in DNN 7

                Print      Add To Favorite     Add To Watch List     Contact Author

Creator: host   11/18/2015 2:36:22 AM    Author: Brian Dukes   Source: http://www.dnnsoftware.com/community-blog/cid/155157/using-javascript-libraries-in-dnn   Views: 1505    0    0  
Tags:
Module develop Javascript dnn 7

In December 2013, version 7.2 of the DNN Platform was released, which included a new type of extension, the JavaScript Library. At Engage, we've found this to be very useful to us in many scenarios, and we've been investing in creating a solid body of libraries, but I don't think that many other developers or theme designers are aware of it and how they can make use of it.

JavaScript Library packages are deceptively simple. At one level, they just package a single JavaScript file. However, the existence of this package provides a number of straightforward benefits:

  1. DNN allows multiple versions of a JavaScript Library package to be installed, so different extensions can request different versions.
  2. However, if different extensions on the same page request different versions, the highest version wins, which reduces script conflicts.
  3. The library defines metadata about the JavaScript library, such as where in the document it is included (e.g. html5shiv is automatically included in the page's <head>, but most other libraries can wait until the end of the </form>, speeding up initial rendering time)
  4. Additionally, a CDN URL can be included with a JavaScript package, allowing a host administrator to flip a switch and benefit from globally distributed versions of the script (this also provides the benefit of domain sharding). Along with this, a JavaScript expression to test is also included, so that DNN can fallback to the local version of the script if the CDN is inaccessible.

So, how do I get these wonderful benefits in my DNN website? The first step is to check out the Usage section of the wiki article on JavaScript Libraries, and see what it looks like to use JavaScript Libraries in your own extensions. Once you're ready to use them, you'll need to have them available to you. Engage has created a handful of packages for libraries that we're using (see them on the Forge), but I'm sure that this doesn't contain every library that you might use on your site or in your extensions. If you grab a copy of our JavaScript Libraries repository on GitHub, there is a PowerShell script in there to generate a package based on information from Bower. Reach out to me on Twitter if you're interested in contributing more packages.

The real benefit of JavaScript libraries starts to come when they're used by more and more components in a website. Let me or other folks working on DNN or in the MVP group know what you need to make better use of features like this that DNN provides, so we can create the best platform for your web applications. If you're interested in helping out, the README in Engage's GitHub repository has a Roadmap section with some ideas.


Rating People: 0   Average Rating:     

     DnnModule.com is built to provide DNN quality modules and DNN skins, some of them are free, some not. We wish these stuffs (free or not ) can be useful to you.

     Besides that, we also provide a full range of professional services, ranging from web site build, seo, system management, administration, support, senior consultancy and security services. We act as if your development project or network was ours, with care and respect. We are not satisfied until it works the way you want it to, and we don't silently ignore found issues as somebody else's problem.