# Pastebin HyuX7erd var gulp = require('gulp'); var concat = require('gulp-concat'); var server = require('gulp-express'); //var uglifyjs = require('gulp-uglifyjs'); //var imagemin = require('gulp-imagemin'); //var minifyCSS = require('gulp-minify-css'); //var del = require('del'); var appName = 'your_proj'; var Path = { template: 'script/**/*.html', index: 'index.html', script: 'script/**/*.js', module: 'script/**/*.module.js', notmodule: 'script/**/*.!(module).js', //vendor: '../../bower_components/', all: '**/*', css: 'script/**/*.css', image: 'img/**/*', // could exclude !psd serverBase: '../../server/'+appName, serverPublic: '../../server/'+appName +'/public', }; // this works because we have no index file - any html are templates from routes gulp.task('template',function() { return gulp.src(Path.template) .pipe(gulp.dest(Path.serverPublic+'/template')); }); gulp.task('index',function() { return gulp.src('index.html') .pipe(gulp.dest(Path.serverPublic)); }); gulp.task('css',function() { return gulp.src(Path.css) .pipe(concat('main.css')) .pipe(gulp.dest(Path.serverPublic)); }); gulp.task('image',function() { return gulp.src(Path.image) .pipe(gulp.dest(Path.serverPublic+'/image')); }); gulp.task('bower',function() { return gulp.src('bower.json') .pipe(gulp.dest(Path.serverPublic)); }); gulp.task('script',['module-script','notmodule-script']); gulp.task('module-script',function() { return gulp.src(Path.module) .pipe(concat('module.js')) .pipe(gulp.dest(Path.serverPublic+'/template')); }); gulp.task('notmodule-script',function() { return gulp.src(Path.notmodule) .pipe(concat('notmodule.js')) .pipe(gulp.dest(Path.serverPublic+'/template')); }); gulp.task('start-all',function() { server.run({ file: Path.serverBase + '/app.js', port: 35729 }); gulp.watch([Path.css], ['css']); gulp.watch([Path.script],['script']); gulp.watch([Path.image], ['image']); gulp.watch([Path.template], ['template']); gulp.watch([Path.index], ['index']); //gulp.watch([Path.serverBase + '/routes/**/*.js'],server.run); gulp.watch([Path.serverPublic + '/template/**/*.html'], server.notify); gulp.watch([Path.serverPublic + '/**/*.css'], server.notify); gulp.watch([Path.serverPublic + '/template/**/*.js'],server.notify); gulp.watch([Path.serverPublic + '/images/**/*'], server.notify); gulp.watch([Path.serverPublic + '/bower_components/**/*'], server.notify); gulp.watch([Path.serverBase + '/routes/**/*.js'],server.run); // TODO: watch bower folder, on change, copy bower.json and rerun bower install }); gulp.task('copy-all-simple',['template','css','script','image','index','bower']); gulp.task('copy-all',function() { return gulp.src(Path.all) .pipe(gulp.dest(Path.serverPublic)); }); //gulp.task('default',['script','css','html']); //gulp.task('default',['copy-all']); gulp.task('default',['copy-all-simple','start-all']);