Created
March 22, 2016 13:00
-
-
Save Arfey/371f61c1c0aabefa5b2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const clean = require('gulp-clean'); | |
const gulp = require('gulp'); | |
const stylus = require('gulp-stylus'); | |
const uglify = require('gulp-uglify'); | |
const concat = require('gulp-concat'); | |
const imageop = require('gulp-image-optimization'); | |
const server = require('gulp-express'); | |
gulp.task("default", ['styl', 'js', 'images', 'fonts', 'html', 'csslib', 'jslib', 'watch'], () => { | |
server.run(['server.js']); | |
}); | |
// clean | |
gulp.task('clean', function () { | |
return gulp.src('app') | |
.pipe(clean()); | |
}); | |
// stylus app | |
gulp.task('styl', () => { | |
return gulp.src('./main/stylus/main.styl') | |
.pipe(stylus()) | |
.pipe(concat('style.min.css')) | |
.pipe(gulp.dest('./app/css/')); | |
}); | |
// EcmaScript app | |
gulp.task('js', () => { | |
return gulp.src('main/js/*.js') | |
.pipe(uglify()) | |
.pipe(concat('main.js')) | |
.pipe(gulp.dest('./app/js/')); | |
}); | |
// img | |
gulp.task('images', () => { | |
return gulp.src(['main/img/*']) | |
.pipe(imageop()) | |
.pipe(gulp.dest('app/img/')) | |
}); | |
// fonts | |
gulp.task('fonts', () => { | |
return gulp.src(['main/fonts/*']) | |
.pipe(gulp.dest('app/fonts/')) | |
}); | |
// jade | |
gulp.task('html', () => { | |
return gulp.src(['main/html/*.html']) | |
.pipe(gulp.dest('app/html/')) | |
}); | |
gulp.task('jslib', () => { | |
return gulp.src(['main/js/lib/*.js']) | |
.pipe(gulp.dest('app/js/')) | |
}); | |
gulp.task('csslib', () => { | |
return gulp.src(['main/stylus/lib/*.css']) | |
.pipe(gulp.dest('app/css/')) | |
}); | |
// jade | |
// gulp.task('jade', () => { | |
// return gulp.src(['main/html/*.html']) | |
// .pipe(gulp.dest('app/html/')) | |
// }); | |
// watch task | |
gulp.task('watch', () => { | |
gulp.watch('./main/stylus/*.styl', ['styl']); | |
gulp.watch('./main/js/*.js', ['js']); | |
gulp.watch('./main/img/*', ['images']); | |
gulp.watch('./main/fonts/*', ['fonts']); | |
gulp.watch('./main/html/*', ['html']); | |
gulp.watch('./main/stylus/lib/*', ['csslib']); | |
gulp.watch('./main/js/lib/*', ['jslib']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment