jsdelivr.net intergration for MODX Revolution

Syntax:

    
        [[jsdelivr.net?
            &subresources=`{
                "link" : [
                    { "package" : "", "version" : "", "file" : "", "integrity" : "", "crossorigin" : "" },

                    { "user" : "", "repo" : "", "version" : "", "file" : "", "integrity" : "", "crossorigin" : "" },

                    { "svn" : "plugins", "project" : "", "version" : "", "file" : "", "integrity" : "", "crossorigin" : "" },
                    { "svn" : "themes", "project" : "", "version" : "", "file" : "", "integrity" : "", "crossorigin" : "" }
                ],
                "script" : [
                    { "package" : "", "version" : "", "file" : "", "async" : "", "defer" : "", "integrity" : "", "crossorigin" : "" },

                    { "user" : "", "repo" : "", "version" : "", "file" : "", "async" : "", "defer" : "", "integrity" : "", "crossorigin" : "" },

                    { "svn" : "plugins", "project" : "", "version" : "", "file" : "", "async" : "", "defer" : "", "integrity" : "", "crossorigin" : "" },
                    { "svn" : "themes", "project" : "", "version" : "", "file" : "", "async" : "", "defer" : "", "integrity" : "", "crossorigin" : "" }
                ]
            }`
            &async=`false`
            &defer=`false`
            &integrity=`sha256 sha384 sha512`
            &crossorigin=`anonymous`
            &lifetime=`604800`
        ]]
        [[+jsdelivr.net.link]]
        [[+jsdelivr.net.script]]
    

Script properties:

&subresources
Required. JSON-object, containing information about subresources, their versions and files. Depending on a source required parameters are different.
Package name is required for NPM, while all other properties are replaced by redirect defaults, if unspecified. A lot of packages have their default filename unassigned.
Username, repository and filename are required for GitHub, while version is replaced by latest, if unspecified.
WordPress SVN repository for plugins requires only project and filename, while version is replaced by latest, if unspecified. WordPress SVN repository for themes requires all parameters to be filled in.
All filenames, regardless of source, can have a .min subextension for automatic CDN minification.
&async
Optional. Default is false. Async attribute value for all script subresources. Value is interpreted as a boolean. Can be specified for a script subresource.
&defer
Optional. Default is false. Defer attribute value for all script subresources. Value is interpreted as a boolean. Can be specified for a script subresource.
&integrity
Optional. Default is sha256 sha384 sha512. Algorithm to use for subresource integrity hashing. Case insensitive. Possible values are: sha256, sha384, sha512, or any their combination. Can be specified for a subresource.
&crossorigin
Optional. Default is anonymous. Crossorigin attribute value for all subresources. Case insensitive. Possible values are: anonymous, use-credentials. Can be specified for a subresource.
&lifetime
Optional. Default is 604800. Subresource cache lifetime.

Placeholders:

[[+jsdelivr.net.link]]
Placeholder for all subresource link tags.
[[+jsdelivr.net.script]]
Placeholder for all subresource script tags.

Examples:

Most recent jQuery from NPM and prism.js ( async ) from GitHub with automatic CDN minification and daily updates:

    
        [[jsdelivr.net?
            &subresources=`{
                "script" : [
                    { "package" : "jquery", "file" : "dist/jquery.min.js" },
                    { "user" : "PrismJS", "repo" : "prism", "file" : "prism.min.js", "async" : "true" }
                ]
            }`
            &lifetime=`86400`
        ]]
    

A complete Twenty EightteenWordPress theme and a Slimstat Analytics from WordPress CDN with automatic CDN minification for all files and defer for all script subresources:

    
        [[jsdelivr.net?
            &subresources=`{
                "link" : [
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/css/colors-dark.min.css" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/css/editor-style.min.css" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/css/ie8.min.css" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/css/ie9.min.css" }
                ],
                "script" : [
                    { "svn" : "plugins", "project" : "wp-slimstat", "version" : "4.6.5", "file" : "wp-slimstat.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/customize-controls.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/customize-preview.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/global.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/html5.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/jquery.scrollTo.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/navigation.min.js" },
                    { "svn" : "themes", "project" : "twenty-eightteen", "version" : "1.7", "file" : "assets/js/skip-link-focus-fix.min.js" }
                ]
            }`
            &defer=`true`
        ]]
    

Notes:

Cache can be refreshed manually from Manage / Clear Cache / jsdelivr.net menu.