-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
49 lines (45 loc) · 1.53 KB
/
gulpfile.js
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
var gulp = require('gulp');
var less = require('gulp-less');
var header = require('gulp-header');
var cleanCSS = require('gulp-clean-css');
var rename = require('gulp-rename');
var coffee = require('gulp-coffee');
var pkg = require('./package.json');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
// Set the banner content
var banner = ['/*!\n',
' * Studio Riehl - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n',
' * Copyright 2017-' + (new Date()).getFullYear(), ' <%= pkg.author %>\n',
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n',
' */\n',
''
].join('');
// Compile and minify less
gulp.task('styles', function() {
return gulp.src('./less/styles.less')
.pipe(less())
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('./src/css'))
.pipe(cleanCSS({ compatibility: 'ie8'}))
.pipe(header(banner, { pkg: pkg }))
.pipe(rename({ suffix: '.min'}))
.pipe(gulp.dest('./public/css'))
});
// compile and minify coffeescript files
gulp.task('coffee', function() {
return gulp.src('./coffee/*.coffee')
.pipe(coffee({bare: true}))
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('./src/js'))
.pipe(concat('index.js'))
.pipe(uglify())
.pipe(header(banner, { pkg: pkg }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./public/js'))
});
//watch for new coffeescript and less files
gulp.task('watch', function() {
gulp.watch('./coffee/*.coffee', ['coffee']);
gulp.watch('./less/styles.less', ['styles']);
});