Skip to content

Commit

Permalink
Added the option to build admin js for jQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Aug 6, 2022
1 parent 634df32 commit 9bcd3ff
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,22 @@ gulp.task(
gulp.task('build:deps', gulp.parallel('build:deps:composer', 'build:deps:npm'));

gulp.task('build:js:admin', function () {
function bundle(name, sources) {
function bundle(name, sources, jQuery = false) {
const tsProject = ts.createProject('tsconfig.json');
return gulp
let ret = gulp
.src(sources.concat(['src/d.ts/*.d.ts']))
.pipe(tsProject())
.js.pipe(concat(name + '.min.js'))
.pipe(terser())
.pipe(gulp.dest('dist/admin/js/'));
.js.pipe(concat(name + '.min.js'));
if (jQuery) {
ret = ret
.pipe(
inject.prepend(
'jQuery( document ).ready( function( $ ) {\n'
)
)
.pipe(inject.append('} );\n'));
}
return ret.pipe(terser()).pipe(gulp.dest('dist/admin/js/'));
}

return merge(
Expand Down

0 comments on commit 9bcd3ff

Please sign in to comment.