Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Wrap specified JavaScript documents in the Universal Module Definition (UMD) allowing them to run in AMD, Require.js, CommonJS/Node.js and Vanilla environments automatically

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .npmignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Backers.md
Octocat-spinner-32 Cakefile
Octocat-spinner-32 History.md
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Universal Module Definition (UMD) Plugin for DocPad

Build Status NPM version Flattr donate button PayPayl donate button

Wrap specified JavaScript documents in the Universal Module Definition (UMD) allowing them to run in AMD, Require.js, CommonJS/Node.js, Ender and Vanilla environments automatically

Install

docpad install umd

Usage

For the documents that you want to be wrapped inside UMD, specify umd: true inside your document's meta data header like so:

---
umd: true
---

// your javascript content

and it will be transformed into:

/*global define:false require:false */
(function (name, context, definition) {
    if (typeof module !== 'undefined' && module.exports) module.exports = definition();
    else if (typeof define === 'function' && define.amd) define(definition);
    else if (typeof provide === 'function') provide(name, definition());
    else context[name] = definition();
})('the-javascript-file-basename', this, function(){
    // your javascript content
});

History

You can discover the history inside the History.md file

Backers

You can discover the financial backers of this project inside the Backers.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2013+ Bevry Pty Ltd

Something went wrong with that request. Please try again.