Created
April 11, 2016 18:09
-
-
Save clovisdasilvaneto/17e93f01dcddc9ca79a8c3dd12f4ed36 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'), | |
sass = require('gulp-sass') , | |
notify = require("gulp-notify") , | |
uglify = require('gulp-uglify'), | |
concat = require('gulp-concat'); | |
var 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('css', function() { | |
return gulp.src(config.sassPath + '/style.scss') | |
.pipe(sass({outputStyle: 'compressed'}).on('error', | |
notify.onError(function (error) { | |
return "Error: " + sass.logError | |
}) | |
)) | |
.pipe(gulp.dest('./css')) | |
.pipe(gulp.dest(config.tomcat + config.themeFolder + '/css')); | |
}); | |
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/')); | |
}) | |
}); | |
// Rerun the task when a file changes | |
gulp.task('watch', function() { | |
gulp.watch(config.sassPath + '/**/*.scss', ['css']); | |
gulp.watch(config.jsPath + '/**/*.js', ['compress']); | |
}); | |
gulp.task('default', ['css', 'compress','watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment