gulp from node file

This commit is contained in:
Jörn-Michael Miehe 2018-09-30 23:23:05 +02:00
parent 0bb91a1403
commit 088f554820
5 changed files with 13 additions and 10 deletions

View file

@ -1,8 +1,5 @@
FROM node:latest
# global deps
RUN npm install gulp-cli -g
# Create app directory
WORKDIR /usr/src/app
@ -17,7 +14,6 @@ RUN npm install
# Bundle app source
COPY . .
RUN gulp
EXPOSE 8080

View file

@ -8,7 +8,9 @@ var concat = require('gulp-concat');
var paths = {
coffee: 'client/scripts/**/*.coffee',
lib: 'client/lib/**/*.js',
images: 'client/img/**/*'
images: 'client/img/**/*',
dest: 'static',
maps: 'maps'
};
gulp.task('coffee', function(){
@ -20,16 +22,16 @@ gulp.task('coffee', function(){
return '$(function () {' + contents + '});';
}))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('static'))
.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())
.pipe(gulp.dest('static'))
.pipe(sourcemaps.write(paths.maps))
.pipe(gulp.dest(paths.dest))
});
gulp.task('default', [ 'coffee', 'lib' ]);

View file

@ -2,7 +2,12 @@
var
http = require('http'),
socketio = require('socket.io'),
express = require('express');
express = require('express'),
gulp = global.gulp = require('gulp');
// gulp the sources
require('./gulpfile');
gulp.start('default');
// socket.io framework
let app = express();