Installation
Install package with NPM and add it to your development dependencies:
npm install --save-dev gulp-deamdify
Information
Package | gulp-deamdify |
Description | Converts a module written in various files and AMD format in an autonomous one-file module. |
Node Version | >= 1.0.0 |
Inspiration
Suppose you are writing a library in Javascript (or in any other compile-to-javascript language) and you would want to split it in more than one file without having external dependencies.
In example, let's say you have this library
// Main.js // file3.js // file2.js // file1.js
This plugin polyfills the code with a tiny AMD library and concatenates the results in order to get an one-file script that does exactly what your original code does. Note that this plugin won't order your files, you'll have to use another plugin such as gulp-amd-optimizer
Reason to be
-
It can be used with gulp-umd in order to take a library written under AMD format and compile it to UMD format, so it can be later used with RequireJs and CommonJs.
-
It is possible to transpile Typescript to Javascript using AMD module resolution, and transform the result to code that does not depend on external dependencies.
-
It is an alternative to Babel's deamdify, since it can be used with Typescript or CoffeeScript.
Usage
Usage with Javascript
var deamdify = ;var optimizer = ; gulp;
Usage with Typescript
var deamdify = ;var ts = ; gulptask 'build' -> return gulp
Usage with gulp-umd
var deamdify = ;var ts = ;var umd = ;gulp;
Contribute
Please feel free to fork or post and issue if you feel like.
License
Published under MIT License.