Skip to content

Commit

Permalink
fix(umd): adding polyfill as UMD - jwilsson#12
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneyrehm committed Mar 1, 2016
1 parent 37e33b9 commit 6f69cc9
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,42 @@ gulp.task('build-umd', ['lint'], function () {
.pipe(gulp.dest('dist'));
});

gulp.task('build-polyfill-umd', ['build-umd'], function () {
return gulp.src(['src/DOMTokenList-newest.js', 'src/classList.js', 'src/relList.js', 'src/svg.classList.js'])
.pipe(concat('domtokenlist-polyfill-umd.js'))
.pipe(footer('window.DOMTokenList = DOMTokenList;'))
.pipe(umd({
dependencies: function() {
return [
{
name: 'DOMTokenList',
amd: './domtokenlist-umd',
cjs: './domtokenlist-umd',
global: 'DOMTokenList',
param: 'DOMTokenList'
}
];
},
exports: function(file) {
return 'DOMTokenList';
},
namespace: function(file) {
return 'DOMTokenList';
},
}))
.pipe(header(copyright))
.pipe(gulp.dest('dist'))
.pipe(uglify({
preserveComments: 'some',
}))
.pipe(rename({
suffix: '.min',
}))
.pipe(gulp.dest('dist'));
});

gulp.task('dev', ['build', 'build-umd'], function () {
gulp.watch(files, ['build', 'build-umd'])
gulp.watch(files, ['build', 'build-umd', 'build-polyfill-umd'])
});

gulp.task('default', ['build', 'build-umd']);

0 comments on commit 6f69cc9

Please sign in to comment.