summaryrefslogtreecommitdiffhomepage
path: root/gulpfile.js
blob: becf429eafae4284df7bd6dea3f4730362582bf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var gulp = require('gulp'),
	bower = require('gulp-bower'),
	changed = require('gulp-changed'),
	jade = require('gulp-jade'),
	jadeModules = require('gulp-jade-modules'),
	minifyhtml = require('gulp-minify-html'),
	notify = require('gulp-notify'),
	sass = require('gulp-ruby-sass');

var config = {
	sassPath: './resources/sass',
	jadePath: './resources/jade',
	bowerDir: './bower_components'
}

gulp.task('watch', function() {
	gulp.watch(config.sassPath + '/**/*.scss', ['css']);
	gulp.watch(config.jadePath + '/**/*.jade', ['jade']);
});

gulp.task('default', ['bower', 'css', 'jade', 'img']);

gulp.task('bower', function() {
	return bower()
		.pipe(gulp.dest(config.bowerDir));
});

gulp.task('css', function() {
	return gulp.src(config.sassPath + '/style.scss')
		.pipe(sass({
				style: 'compressed',
				loadPath: [
					'./resources/sass',
					config.bowerDir + '/bootstrap-sass-official/assets/stylesheets'
				]
			})
			.on('error', notify.onError(function (error) {
				return "Error: " + error.message;
			}))
		)
		.pipe(gulp.dest('./build/assets/css'));
});

gulp.task('jade', function() {
	var src = './resources/jade/finals/**/*.jade',
		dst = './build';

	return gulp.src(src)
		.pipe(changed(dst, {extension: 'html'}))
		.pipe(jadeModules({
			paths: ['./resources/jade/include']
		}))
		.pipe(jade({
			basedir: '/'
		}))
		.pipe(minifyhtml())
		.pipe(gulp.dest(dst));
});

gulp.task('img', function() {
	return gulp.src('./resources/img/*')
		.pipe(gulp.dest('./build/assets/img'));
});