https://github.com/docpad/docpad-plugin-umd
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
https://github.com/docpad/docpad-plugin-umd
docpad-plugin
Last synced: about 1 year ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/docpad/docpad-plugin-umd
- Owner: docpad
- License: other
- Created: 2013-05-29T11:51:34.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2023-12-31T22:21:32.000Z (over 2 years ago)
- Last Synced: 2025-03-25T19:50:30.533Z (about 1 year ago)
- Topics: docpad-plugin
- Language: JavaScript
- Homepage:
- Size: 210 KB
- Stars: 12
- Watchers: 16
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
docpad-plugin-umd
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
## 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:
``` javascript
/*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
});
```
Install
Install this DocPad plugin by entering docpad install umd into your terminal.
History
Discover the release history by heading on over to the HISTORY.md file.
Contribute
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
Backers
Maintainers
These amazing people are maintaining this project:
Sponsors
These amazing people have contributed finances to this project:
Become a sponsor!
Contributors
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
License
Unless stated otherwise all works are:
- Copyright © 2013+ Bevry Pty Ltd
and licensed under: