-
-
Save ryanmr/05f95ac78c999f942fb27603ca4d8c00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var stripDebug = require('gulp-strip-debug'); | |
var uglify = require('gulp-uglify'); | |
var concat = require('gulp-concat'); | |
var notify = require('gulp-notify'); | |
var notifier = require('node-notifier'); | |
var browserify = require('browserify'); | |
var babelify = require('babelify'); | |
var stringify = require('stringify'); | |
var gutil = require('gulp-util'); | |
var gif = require('gulp-if'); | |
var plumber = require('gulp-plumber'); | |
var yargs = require('yargs'); | |
var config = { | |
ROOT_SRC_INDEX: './src/main/resources/static/js/index.js', | |
WATCH_DIRECTORY: './src/main/resources/static/js/**', | |
OUTPUT: './target/classes/static/build/', | |
production: yargs.argv.production, | |
vendor: [ | |
'./node_modules/jquery/dist/jquery.js', | |
'./node_modules/knockout/build/output/knockout-latest.debug.js', | |
'./node_modules/knockout-mapping/dist/knockout.mapping.js', | |
'./node_modules/knockout.validation/dist/knockout.validation.js' | |
] | |
}; | |
gulp.task('js-app', function (){ | |
return browserify({entries: config.ROOT_SRC_INDEX, extensions: ['.js']}) | |
.transform(babelify, {presets: ['es2015']}) | |
.transform(stringify, { | |
appliesTo: {includeExtensions: ['.html']}, | |
minify: true | |
}) | |
.bundle().on('error', function(err){ | |
gutil.log(err.stack); | |
var message = err.filename + "\n" + "Position:\n\tline = " + err.loc.line + "\n\tcolumn = " + err.loc.column + "\n"; | |
notifier.notify({ title: 'JavaScript Compilation Error', message: message }); | |
this.emit('end'); | |
}) | |
.pipe(plumber()) | |
.pipe(source('bundle.js')) | |
.pipe(buffer()) | |
.pipe(config.production ? stripDebug() : gutil.noop()) | |
.pipe(config.production ? uglify() : gutil.noop()) | |
.pipe(gulp.dest(config.OUTPUT)) | |
.pipe(notify({title: "JavaScript Compilation Successful", message: "bundle.js - complete"})); | |
}); | |
gulp.task('js-vendor', function(){ | |
return gulp.src(config.vendor) | |
.pipe(concat('vendor.js')) | |
.pipe(config.production ? uglify() : gutil.noop()) | |
.pipe(gulp.dest(config.OUTPUT)) | |
.pipe(notify({title: "JavaScript Compilation Successful", message: "vendor.js - complete"})); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch(config.WATCH_DIRECTORY, ['js-app']); | |
}); | |
gulp.task('default', ['js-app', 'js-vendor']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// editing the file | |
require('./utilities.js'); | |
console.log(pdmp); | |
require('./user-management/delegates.js'); | |
require('./user-management/profile.js'); | |
require('./user-management/groups.js'); | |
require('./user-management/roles.js'); | |
require('./user-management/users.js'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment