2015-10-15 09:14:19 +00:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var autoprefixer = require('gulp-autoprefixer');
|
|
|
|
var sass = require('gulp-sass');
|
|
|
|
var gutil = require('gulp-util');
|
|
|
|
var concat = require('gulp-concat');
|
|
|
|
var coffee = require('gulp-coffee');
|
|
|
|
var eco = require('gulp-eco');
|
|
|
|
var rename = require('gulp-rename');
|
|
|
|
var uglify = require('gulp-uglify');
|
|
|
|
var merge = require('merge-stream');
|
|
|
|
var plumber = require('gulp-plumber');
|
|
|
|
|
|
|
|
gulp.task('css', function(){
|
2015-11-11 09:37:07 +00:00
|
|
|
return gulp.src('chat.scss')
|
2015-10-15 09:14:19 +00:00
|
|
|
.pipe(sass.sync().on('error', gutil.log))
|
|
|
|
.pipe(autoprefixer({
|
|
|
|
browsers: ['last 4 versions'],
|
|
|
|
cascade: false
|
|
|
|
}))
|
|
|
|
.pipe(gulp.dest('./'));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('js', function(){
|
|
|
|
var templates = gulp.src('views/*.eco')
|
|
|
|
.pipe(eco({namespace: 'zammadChatTemplates'}));
|
|
|
|
|
|
|
|
var js = gulp.src('chat.coffee')
|
|
|
|
.pipe(plumber())
|
|
|
|
.pipe(coffee({bare: true}).on('error', gutil.log));
|
|
|
|
|
|
|
|
var autoGrow = gulp.src('jquery.autoGrow.js');
|
|
|
|
|
|
|
|
return merge(templates, js, autoGrow)
|
|
|
|
.pipe(concat('chat.js'))
|
|
|
|
.pipe(gulp.dest('./'))
|
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(rename({ extname: '.min.js' }))
|
|
|
|
.pipe(gulp.dest('./'));
|
|
|
|
});
|
|
|
|
|
|
|
|
gulp.task('default', function(){
|
2015-11-11 09:37:07 +00:00
|
|
|
var cssWatcher = gulp.watch('chat.scss', ['css']);
|
2015-10-15 09:14:19 +00:00
|
|
|
cssWatcher.on('change', function(event) {
|
|
|
|
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
|
|
|
|
});
|
|
|
|
|
|
|
|
var jsWatcher = gulp.watch(['chat.coffee', 'views/*.eco'], ['js']);
|
|
|
|
jsWatcher.on('change', function(event) {
|
|
|
|
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
|
|
|
|
});
|
|
|
|
});
|