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

38 lines
1,004 B
JavaScript
Raw Normal View History

2018-09-30 18:21:59 +00:00
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
2018-09-30 20:23:16 +00:00
var coffee = require('gulp-coffee');
var insert = require('gulp-insert');
2018-09-30 18:21:59 +00:00
var uglify = require('gulp-uglify-es').default;
2018-09-30 20:23:16 +00:00
var concat = require('gulp-concat');
2018-09-30 18:21:59 +00:00
var paths = {
2018-09-30 20:50:48 +00:00
coffee: 'client/scripts/**/*.coffee',
lib: 'client/lib/**/*.js',
2018-09-30 21:23:05 +00:00
images: 'client/img/**/*',
dest: 'static',
maps: 'maps'
2018-09-30 18:21:59 +00:00
};
2018-09-30 20:50:48 +00:00
gulp.task('coffee', function(){
return gulp.src(paths.coffee)
2018-09-30 18:21:59 +00:00
.pipe(sourcemaps.init())
.pipe(concat('app.min.js'))
2018-09-30 20:23:16 +00:00
.pipe(coffee({bare: true}))
.pipe(insert.transform(function(contents, file) {
return '$(function () {' + contents + '});';
}))
2018-09-30 18:21:59 +00:00
.pipe(uglify())
2018-09-30 21:23:05 +00:00
.pipe(sourcemaps.write(paths.maps))
.pipe(gulp.dest(paths.dest))
2018-09-30 18:21:59 +00:00
});
2018-09-30 20:50:48 +00:00
gulp.task('lib', function(){
return gulp.src(paths.lib)
.pipe(sourcemaps.init())
.pipe(concat('lib.min.js'))
2018-09-30 21:23:05 +00:00
.pipe(sourcemaps.write(paths.maps))
.pipe(gulp.dest(paths.dest))
2018-09-30 20:50:48 +00:00
});
gulp.task('default', [ 'coffee', 'lib' ]);