This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/gulpfile.js

37 lines
1,004 B
JavaScript

var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var coffee = require('gulp-coffee');
var insert = require('gulp-insert');
var uglify = require('gulp-uglify-es').default;
var concat = require('gulp-concat');
var paths = {
coffee: 'client/scripts/**/*.coffee',
lib: 'client/lib/**/*.js',
images: 'client/img/**/*',
dest: 'static',
maps: 'maps'
};
gulp.task('coffee', function(){
return gulp.src(paths.coffee)
.pipe(sourcemaps.init())
.pipe(concat('app.min.js'))
.pipe(coffee({bare: true}))
.pipe(insert.transform(function(contents, file) {
return '$(function () {' + contents + '});';
}))
.pipe(uglify())
.pipe(sourcemaps.write(paths.maps))
.pipe(gulp.dest(paths.dest))
});
gulp.task('lib', function(){
return gulp.src(paths.lib)
.pipe(sourcemaps.init())
.pipe(concat('lib.min.js'))
.pipe(sourcemaps.write(paths.maps))
.pipe(gulp.dest(paths.dest))
});
gulp.task('default', [ 'coffee', 'lib' ]);