Skip to content

Instantly share code, notes, and snippets.

@clovisdasilvaneto
Created January 18, 2017 17:24
Show Gist options
  • Save clovisdasilvaneto/28874e5b957bbe384ce27417a82daba8 to your computer and use it in GitHub Desktop.
Save clovisdasilvaneto/28874e5b957bbe384ce27417a82daba8 to your computer and use it in GitHub Desktop.
"use strict";
const gulp = require('gulp'),
notify = require("gulp-notify"),
uglify = require('gulp-uglify'),
concat = require('gulp-concat');
let config = {
jsPath: './js/modules',
jsCompressPath: './js/build/compress',
sassPath: './scss',
tomcat: '/Users/clovisneto/Liferay/SIGEX/liferay-portal-6.2-ee-sp13/tomcat-7.0.62/',
themeFolder: 'webapps/sigex-theme'
}
gulp.task('compress', function() {
return gulp.src(config.jsPath +'/*.js')
.pipe(uglify())
.pipe(gulp.dest(config.jsCompressPath))
.pipe(gulp.dest(config.tomcat + config.themeFolder + '/js/build/compress')).on('end', function(){
gulp.src(config.jsCompressPath +'/*.js').pipe(concat('main.js'))
.pipe(gulp.dest('./js/build'))
.pipe(gulp.dest(config.tomcat + config.themeFolder + '/js/build/'))
.pipe(notify("Javascript OK!"));
})
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(config.jsPath + '/**/*.js', ['compress']);

});
gulp.task('default', ['compress','watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment