rob-kistner
10/14/2016 - 12:47 AM

gulp standard

gulp standard

var gulp = require('gulp'),
	gutil = require('gulp-util'),
	concat = require('gulp-concat'),
	connect = require('gulp-connect'),
	sass = require('gulp-sass'),
	coffee = require('gulp-coffee'),
	jade = require('gulp-jade');

// sources
//
var jade_src = [
	'assets/jade/*.jade'
	];
var jade_lib_src = [
	'assets/jade/partials/*.jade'
	];
var coffee_src = [
	'assets/coffee/*.coffee'
	];
var js_src = [
	'assets/js/*.js'
	];
var scss_src = [
	'assets/scss/*.scss'
	];
var scss_lib_src = [
	'assets/lib/scss/*.scss'
	];
var build_dir = 'builds/development/';


gulp.task('lib', function() {
	gulp.src('assets/lib/**/*.*')
		.pipe(gulp.dest(build_dir + 'lib'))
});

gulp.task('js', function() {
	gulp.src(js_src)
		.pipe(gulp.dest(build_dir + 'js'))
		.pipe(connect.reload());
});


gulp.task('coffee', function() {
	gulp.src(coffee_src)
		.pipe(coffee({bare: true})
			.on('error', gutil.log))
		.pipe(gulp.dest(build_dir + 'js'))
		.pipe(connect.reload())
});

gulp.task('sass', function() {
	gulp.src(scss_src)
		.pipe(sass({
			outputStyle: 'compact',
			indentType: 'tab'
		})
			.on('error', gutil.log))
		.pipe(gulp.dest(build_dir + 'css'))
		.pipe(connect.reload())
	console.log("refreshing...")
});

gulp.task('jade', function() {
	gulp.src(jade_src)
		.pipe(jade({pretty: true})
			.on('error', gutil.log))
		.pipe(gulp.dest('builds/development'))
		.pipe(connect.reload())
});

gulp.task('watch', function() {
	gulp.watch([scss_lib_src], ['sass'])
	gulp.watch([coffee_src], ['coffee'])
	gulp.watch([js_src], ['js'])
	gulp.watch([scss_src], ['sass'])
	gulp.watch([scss_lib_src], ['sass'])
	gulp.watch([jade_src], ['jade'])
	gulp.watch([jade_lib_src], ['jade'])
});

// test server
gulp.task('connect', function() {
	connect.server({
		root: build_dir,
		port: 3030,
		livereload: true
	})
});

// default task
gulp.task('default', [
	'coffee',
	'js',
	'sass', 
	'jade',
	'watch',
	'connect'
	]);