From 9475cffa5516758def9ee3e354e0d2d8eacb68ca Mon Sep 17 00:00:00 2001 From: Cole R Lawrence Date: Tue, 30 Jun 2015 13:23:37 -0500 Subject: [PATCH] Ensure compatibility with CommonJS, AMD, as well as fallback on browser env --- gulpfile.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 85659f2a8..973820a0a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -68,6 +68,16 @@ gulp.task('scripts', ['clean'], function() { errorHandler: handleError })) .pipe(concat('select.js')) + .pipe(header( + '(function(mod) {\n' + + 'if (typeof exports == "object" && typeof module == "object") // CommonJS\n' + + ' module.exports = mod(require("angular"));\n' + + 'else if (typeof define == "function" && define.amd) // AMD\n' + + ' return define(["angular"], mod);\n' + + 'else // Plain browser env\n' + + ' mod(angular);\n' + + '})(function (angular) {\n"use strict";\n\n')) + .pipe(footer('\n});')) .pipe(header(config.banner, { timestamp: (new Date()).toISOString(), pkg: config.pkg }))