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 FROM node:latest
# global deps
RUN npm install gulp-cli -g
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -17,7 +14,6 @@ RUN npm install
# Bundle app source # Bundle app source
COPY . . COPY . .
RUN gulp
EXPOSE 8080 EXPOSE 8080

View file

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

View file

@ -2,7 +2,12 @@
var var
http = require('http'), http = require('http'),
socketio = require('socket.io'), 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 // socket.io framework
let app = express(); let app = express();