This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (52 loc) · 1.92 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
50
51
52
53
54
// Tasks:
//
// 1. Convert coffeescript to javascript
// 2. Pass javascript through babel
// 3. Put javascript into dist/
// 4. Put everything else into dist/
const gulp = require('gulp');
const coffee = require('gulp-coffee');
const babel = require('gulp-babel');
const log = require('fancy-log');
const postcss = require('gulp-postcss');
const rename = require('gulp-rename');
const cssimport = require('gulp-cssimport');
const postcssGridKiss = require('postcss-grid-kiss');
const postcssCssVariables = require('postcss-css-variables');
const cssnano = require('cssnano');
gulp.task('default', function(done) {
// Pipe any js files (should be none in final build)
gulp.src('./src/js/*.js')
.pipe(gulp.dest('./dist/'))
.on('end', function(){ log("Moved js file to dist") });
// Convert coffee files
gulp.src('./src/js/*.coffee', {sourcemaps: true})
.pipe(coffee({bare: true}))
.on('end', function(){ log("Converted coffee to js") })
.pipe(babel({presets: ['env']}))
.on('end', function(){ log("Piped coffee through Babel") })
.pipe(gulp.dest('./dist/'))
.on('end', function(){ log("Finished processing JS") });
// Pipe images, html, json
gulp.src('./src/images/*.*')
.pipe(gulp.dest('./dist/'));
gulp.src('./src/*.html')
.pipe(gulp.dest('./dist/'));
gulp.src('./src/js/*.json')
.pipe(gulp.dest('./dist/'));
// Post-process, minify and concatenate css files
gulp.src('./src/css/root.css')
.pipe(cssimport())
.on('end', function(){ log("Resolving CSS imports") })
.pipe(postcss([
postcssCssVariables(),
postcssGridKiss(),
// cssnano(),
]))
.on('end', function(){ log("Post-processing CSS") })
.pipe(rename("maitreya.css"))
.pipe(gulp.dest('./dist/'))
.on('end', function(){ log("Finished processing CSS") });
// Finish
done()
});