Permalink
Browse files

Update build to wrap plugin in module.

  • Loading branch information...
jacobtoye committed Jun 28, 2016
1 parent bd2f2fa commit 7fccad071dd60c7733c6dbdb815487b14216c7f4
Showing with 20 additions and 2 deletions.
  1. +2 −2 build/build.js
  2. +16 −0 src/intro.js
  3. +2 −0 src/outro.js
View
@@ -115,8 +115,8 @@ exports.build = function (compsBase32, buildName) {
console.log('Concatenating ' + files.length + ' files...');
var copy = fs.readFileSync('src/copyright.js', 'utf8'),
intro = '(function (window, document, undefined) {\nvar L = window.L;',
outro = '}(window, document));',
intro = fs.readFileSync('src/intro.js', 'utf8'),
outro = fs.readFileSync('src/outro.js', 'utf8'),
newSrc = copy + intro + combineFiles(files) + outro,
pathPart = 'dist/leaflet.label' + (buildName ? '-' + buildName : ''),
View
@@ -0,0 +1,16 @@
(function (factory, window) {
// define an AMD module that relies on 'leaflet'
if (typeof define === 'function' && define.amd) {
define(['leaflet'], factory);
// define a Common JS module that relies on 'leaflet'
} else if (typeof exports === 'object') {
module.exports = factory(require('leaflet'));
}
// attach your plugin to the global 'L' variable
if (typeof window !== 'undefined' && window.L) {
window.LeafletLabel = factory(L);
}
}(function (L) {
View
@@ -0,0 +1,2 @@
return LeafletLabel;
}, window));

0 comments on commit 7fccad0

Please sign in to comment.