diff --git a/framework/core/js/admin/Gulpfile.js b/framework/core/js/admin/Gulpfile.js index 466135e1f..e921028ae 100644 --- a/framework/core/js/admin/Gulpfile.js +++ b/framework/core/js/admin/Gulpfile.js @@ -1,51 +1,20 @@ -var gulp = require('gulp'); -var livereload = require('gulp-livereload'); -var concat = require('gulp-concat'); -var argv = require('yargs').argv; -var uglify = require('gulp-uglify'); -var gulpif = require('gulp-if'); -var merge = require('merge-stream'); -var babel = require('gulp-babel'); -var cached = require('gulp-cached'); -var remember = require('gulp-remember'); +var gulp = require('flarum-gulp'); -var vendorFiles = [ - '../bower_components/loader.js/loader.js', - '../bower_components/mithril/mithril.js', - '../bower_components/jquery/dist/jquery.js', - '../bower_components/moment/moment.js', - '../bower_components/bootstrap/dist/js/bootstrap.js', - '../bower_components/spin.js/spin.js', - '../bower_components/spin.js/jquery.spin.js' -]; - -var moduleFiles = [ - 'src/**/*.js', - '../lib/**/*.js' -]; -var modulePrefix = 'flarum'; - -gulp.task('default', function() { - return merge( - gulp.src(vendorFiles), - gulp.src(moduleFiles) - .pipe(cached('scripts')) - .pipe(babel({ modules: 'amd', moduleIds: true, moduleRoot: modulePrefix })) - .pipe(remember('scripts')) - ) - .pipe(concat('app.js')) - .pipe(gulpif(argv.production, uglify())) - .pipe(gulp.dest('dist')) - .pipe(livereload()); -}); - -gulp.task('watch', ['default'], function () { - livereload.listen(); - var watcher = gulp.watch(moduleFiles.concat(vendorFiles), ['default']); - watcher.on('change', function (event) { - if (event.type === 'deleted') { - delete cached.caches.scripts[event.path]; - remember.forget('scripts', event.path); - } - }); +gulp({ + files: [ + '../bower_components/loader.js/loader.js', + '../bower_components/mithril/mithril.js', + '../bower_components/jquery/dist/jquery.js', + '../bower_components/moment/moment.js', + '../bower_components/bootstrap/dist/js/bootstrap.js', + '../bower_components/spin.js/spin.js', + '../bower_components/spin.js/jquery.spin.js' + ], + moduleFiles: [ + 'src/**/*.js', + '../lib/**/*.js' + ], + bootstrapFiles: [], + modulePrefix: 'flarum', + outputFile: 'dist/app.js' }); diff --git a/framework/core/js/admin/package.json b/framework/core/js/admin/package.json index 51b539e61..3e0ef919d 100644 --- a/framework/core/js/admin/package.json +++ b/framework/core/js/admin/package.json @@ -1,14 +1,7 @@ { + "private": true, "devDependencies": { "gulp": "^3.8.11", - "gulp-babel": "^5.1.0", - "gulp-cached": "^1.0.4", - "gulp-concat": "^2.5.2", - "gulp-if": "^1.2.5", - "gulp-livereload": "^3.8.0", - "gulp-remember": "^0.3.0", - "gulp-uglify": "^1.2.0", - "merge-stream": "^0.1.7", - "yargs": "^3.7.2" + "flarum-gulp": "git+https://github.com/flarum/gulp.git" } } diff --git a/framework/core/js/forum/Gulpfile.js b/framework/core/js/forum/Gulpfile.js index 54b296bc8..ca3d343f9 100644 --- a/framework/core/js/forum/Gulpfile.js +++ b/framework/core/js/forum/Gulpfile.js @@ -1,53 +1,22 @@ -var gulp = require('gulp'); -var livereload = require('gulp-livereload'); -var concat = require('gulp-concat'); -var argv = require('yargs').argv; -var uglify = require('gulp-uglify'); -var gulpif = require('gulp-if'); -var merge = require('merge-stream'); -var babel = require('gulp-babel'); -var cached = require('gulp-cached'); -var remember = require('gulp-remember'); +var gulp = require('flarum-gulp'); -var vendorFiles = [ - '../bower_components/loader.js/loader.js', - '../bower_components/mithril/mithril.js', - '../bower_components/jquery/dist/jquery.js', - '../bower_components/jquery.hotkeys/jquery.hotkeys.js', - '../bower_components/color-thief/js/color-thief.js', - '../bower_components/moment/moment.js', - '../bower_components/bootstrap/dist/js/bootstrap.js', - '../bower_components/spin.js/spin.js', - '../bower_components/spin.js/jquery.spin.js' -]; - -var moduleFiles = [ - 'src/**/*.js', - '../lib/**/*.js' -]; -var modulePrefix = 'flarum'; - -gulp.task('default', function() { - return merge( - gulp.src(vendorFiles), - gulp.src(moduleFiles) - .pipe(cached('scripts')) - .pipe(babel({ modules: 'amd', moduleIds: true, moduleRoot: modulePrefix })) - .pipe(remember('scripts')) - ) - .pipe(concat('app.js')) - .pipe(gulpif(argv.production, uglify())) - .pipe(gulp.dest('dist')) - .pipe(livereload()); -}); - -gulp.task('watch', ['default'], function () { - livereload.listen(); - var watcher = gulp.watch(moduleFiles.concat(vendorFiles), ['default']); - watcher.on('change', function (event) { - if (event.type === 'deleted') { - delete cached.caches.scripts[event.path]; - remember.forget('scripts', event.path); - } - }); +gulp({ + files: [ + '../bower_components/loader.js/loader.js', + '../bower_components/mithril/mithril.js', + '../bower_components/jquery/dist/jquery.js', + '../bower_components/jquery.hotkeys/jquery.hotkeys.js', + '../bower_components/color-thief/js/color-thief.js', + '../bower_components/moment/moment.js', + '../bower_components/bootstrap/dist/js/bootstrap.js', + '../bower_components/spin.js/spin.js', + '../bower_components/spin.js/jquery.spin.js' + ], + moduleFiles: [ + 'src/**/*.js', + '../lib/**/*.js' + ], + bootstrapFiles: [], + modulePrefix: 'flarum', + outputFile: 'dist/app.js' }); diff --git a/framework/core/js/forum/package.json b/framework/core/js/forum/package.json index 51b539e61..3e0ef919d 100644 --- a/framework/core/js/forum/package.json +++ b/framework/core/js/forum/package.json @@ -1,14 +1,7 @@ { + "private": true, "devDependencies": { "gulp": "^3.8.11", - "gulp-babel": "^5.1.0", - "gulp-cached": "^1.0.4", - "gulp-concat": "^2.5.2", - "gulp-if": "^1.2.5", - "gulp-livereload": "^3.8.0", - "gulp-remember": "^0.3.0", - "gulp-uglify": "^1.2.0", - "merge-stream": "^0.1.7", - "yargs": "^3.7.2" + "flarum-gulp": "git+https://github.com/flarum/gulp.git" } }