trabajo-afectivo/public/assets/chat/gulpfile.js

53 lines
1.5 KiB
JavaScript
Raw Normal View History

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(){
return gulp.src('style.scss')
.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(){
var cssWatcher = gulp.watch('style.scss', ['css']);
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...');
});
});