{"id":13790377,"url":"https://github.com/EngageSoftware/DNN-JavaScript-Libraries","last_synced_at":"2025-05-12T09:32:33.466Z","repository":{"id":14657424,"uuid":"17375762","full_name":"EngageSoftware/DNN-JavaScript-Libraries","owner":"EngageSoftware","description":"Common JavaScript libraries packaged as DNN JavaScript Library extensions","archived":false,"fork":false,"pushed_at":"2025-05-06T13:07:49.000Z","size":47318,"stargazers_count":26,"open_issues_count":7,"forks_count":19,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-06T14:30:39.894Z","etag":null,"topics":["dnn","dnncms","dnnplatform","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EngageSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-03-03T18:41:18.000Z","updated_at":"2025-05-06T13:07:47.000Z","dependencies_parsed_at":"2023-10-24T14:29:16.830Z","dependency_job_id":"af671d9d-de0a-4ef7-99bf-3c7095635924","html_url":"https://github.com/EngageSoftware/DNN-JavaScript-Libraries","commit_stats":null,"previous_names":[],"tags_count":642,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2FDNN-JavaScript-Libraries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2FDNN-JavaScript-Libraries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2FDNN-JavaScript-Libraries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngageSoftware%2FDNN-JavaScript-Libraries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngageSoftware","download_url":"https://codeload.github.com/EngageSoftware/DNN-JavaScript-Libraries/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253709210,"owners_count":21951120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dnn","dnncms","dnnplatform","javascript"],"created_at":"2024-08-03T22:00:42.678Z","updated_at":"2025-05-12T09:32:32.929Z","avatar_url":"https://github.com/EngageSoftware.png","language":"JavaScript","readme":"# DNN JavaScript Libraries\r\n\r\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/EngageSoftware/Dnn-JavaScript-Libraries?svg=true)](https://ci.appveyor.com/project/bdukes/dnn-javascript-libraries)\r\n\r\nVersion 7.2 of the [DNN Platform](http://www.dnnsoftware.com) introduced the\r\nJavaScript Library extension type. This allows common JavaScript libraries to\r\nexist in a single place within a DNN site, instead of every module, skin, and\r\npiece of content that wants to include them using their own. DNN presently\r\ncomes with libraries for jQuery, jQuery UI, jQuery Migrate, Knockout, and\r\nKnockout Mapping.\r\n\r\nIn addition to these built-in libraries, new libraries can be installed into\r\nDNN, and used by various components. DNN allows multiple versions of a\r\nJavaScript library to be used, so one module can request a particular version\r\nof a script, while another requests another. So long as they aren't on the same\r\npage, they will get what they requested; otherwise, DNN will use the higher\r\nversion.\r\n\r\n# How to add a new library\r\n\r\nYou'll need to install the dependencies (`yarn install`) and then use the `new`\r\nscript, which will prompt you for the various pieces of information\r\n\r\n```\r\n    yarn install\r\n    yarn run new\r\n```\r\n\r\nAfter that, if you want to ship any other files with the library (e.g. CSS\r\nfiles), you'll want to add those into the `dnn-library.json` file. You can then\r\ncommit your changes and submit a pull request on GitHub.\r\n\r\n# Packages\r\n\r\nThe installable packages are included within this GitHub repository as\r\n[releases](/EngageSoftware/DNN-JavaScript-Libraries/releases).\r\n\r\n# Goal\r\n\r\nThe main benefits in using JavaScript Libraries are realized when they are used\r\nby many separate components within a DNN site (i.e. when there is one common\r\nset of libraries and separate, unrelated DNN skins and modules use those\r\nlibraries instead of packaging scripts directly into the extension). In order\r\nto aid in that goal, we are attempting to create a central repository\r\nof common JavaScript Libraries that can be used by many different DNN extension\r\ndevelopers.\r\n\r\n# Usage\r\n\r\n## Skins\r\n\r\nStarting in DNN 7.3, there is a skin object called `JavaScriptLibraryInclude`\r\nwhich can be used to request a JavaScript library (including jQuery, but also\r\nany 3rd party library) from a skin. To do that, you need to register the skin\r\nobject at the top of your skin:\r\n\r\n    \u003c%@ Register TagPrefix=\"dnn\" TagName=\"JavaScriptLibraryInclude\" Src=\"~/admin/Skins/JavaScriptLibraryInclude.ascx\" %\u003e\r\n\r\nThen, in the body of the skin, use the skin object to request the library:\r\n\r\n    \u003cdnn:JavaScriptLibraryInclude runat=\"server\" Name=\"jQuery\" /\u003e\r\n    \u003cdnn:JavaScriptLibraryInclude runat=\"server\" Name=\"jQuery-UI\" Version=\"1.10.3\" /\u003e\r\n    \u003cdnn:JavaScriptLibraryInclude runat=\"server\" Name=\"jQuery-Migrate\" Version=\"1.2.1\" SpecificVersion=\"LatestMajor\" /\u003e\r\n\r\n## HTML Skins\r\n\r\nThe skin object mentioned above can also be used from HTML skins. It would\r\nlook something like this:\r\n\r\n    \u003cobject codetype=\"dotnetnuke/server\" codebase=\"JavaScriptLibraryInclude\"\u003e\r\n        \u003cparam name=\"Name\" value=\"jQuery\" /\u003e\r\n        \u003cparam name=\"Version\" value=\"1.9.1\" /\u003e\r\n    \u003c/object\u003e\r\n\r\n## Code\r\n\r\nThere is also an API to request JavaScript Libraries from code. This is needed\r\nin skins prior to DNN 7.3 and the introduction of the `JavaScriptLibraryInclude`\r\nskin object, as well as from extension code (though extensions can also make use\r\nof the skin object, if desired). The primary entry point for the API is the\r\n`RequestRegistration` method of the `JavaScript` static class in the\r\n`DotNetNuke.Framework.JavaScriptLibraries` namespace. There are three overloads\r\nto `RequestRegistration`:\r\n\r\n    JavaScript.RequestRegistration(String libraryName)\r\n    JavaScript.RequestRegistration(String libraryName, Version version)\r\n    JavaScript.RequestRegistration(String libraryName, Version version, SpecificVersion specificity)\r\n\r\nThe overload which doesn't specify a version will request the latest version of\r\nthe library. In order to avoid your extensions breaking unexpectedly, it's\r\nprobably best to always specify a version number. The second overload, which\r\nincludes the version number will request that specific version of the library.\r\nIf that version isn't installed, it will instead display an error. The third\r\noverload is probably the best to use for most scenarios. It allows you to pass\r\na value indicating how specific the version is, as a value of the\r\n`SpecificVersion` enum. The possible values are `Latest`, `LatestMajor`,\r\n`LatestMinor`, and `Exact`. `Latest` is the behavior of the overload with one\r\nargument, `Exact` is the behavior of the overload with two arguments, while the\r\nother two values allow you to get behavior that is in between strict and loose.\r\n\r\n# JavaScript Library Features\r\n\r\nWhen requesting that a JavaScript Library is registered, DNN ensures that\r\nboth that library's JavaScript file and all of its dependencies' JavaScript\r\nfiles, get included on the page. The JavaScript library itself will define the\r\nproperties that determine how the file is included on the page. Specifically,\r\nthe library will indicate its preferred location (from page head, body top, and\r\nbody bottom), and can provide a URL to the script on a\r\n\u003cabbr title=\"Content Distribution Network\"\u003eCDN\u003c/abbr\u003e (along with a JavaScript\r\nexpression to use to verify that the CDN loaded the script correctly, so that\r\nDNN can fallback to the local version if the CDN is down). The host\r\nadministrator can configure whether to use the CDN or not (it is off by\r\ndefault).\r\n\r\nThe other main feature that JavaScript Libraries give you is de-duplication of\r\nscripts. This means that if your module and your skin both request the\r\n[html5shiv library](http://www.dnnsoftware.com/forge/html5shiv), it only gets\r\nincluded on the page once (rather than both components including their own\r\nversion of the script). Likewise, if both components request different versions\r\nof the script, just the higher version will be included.\r\n\r\n# License\r\n\r\nThis code is released under the [MIT license](LICENSE.md).\r\nHowever, the individual libraries are licensed by their respective owners.\r\n","funding_links":[],"categories":["Awesome DNN (DotNetNuke) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)"],"sub_categories":["Open Source Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEngageSoftware%2FDNN-JavaScript-Libraries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEngageSoftware%2FDNN-JavaScript-Libraries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEngageSoftware%2FDNN-JavaScript-Libraries/lists"}