-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
85 lines (75 loc) · 1.72 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* Basic gulp file for static site development.
*
*/
/* eslint-env node */
'use strict'
var gulp = require('gulp')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')
var prefix = require('gulp-autoprefixer')
var connect = require('gulp-connect')
var eyeglass = require("eyeglass")
// var kss = require('kss')
var eslint = require('gulp-eslint')
var babel = require('gulp-babel')
var concat = require('gulp-concat')
var sassOptions = {
outputStyle: 'expanded',
eyeglass: {
enableImportOnce: false
}
}
//
// Begin Gulp Tasks.
//
//
// HTML Dev Workflow.
//
gulp.task('html:dev', function () {
return gulp.src(['src/**/*html', '!src/sass/*'])
.pipe(gulp.dest('.'))
.pipe(connect.reload())
})
//
// Images Dev Workflow.
//
gulp.task('images:dev', function () {
return gulp.src('src/**/*.{png,jpg,jpeg,gif,svg}')
.pipe(gulp.dest('.'))
.pipe(connect.reload())
})
//
// CSS Dev Workflow.
//
gulp.task('styles:dev', function () {
return gulp.src('src/sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass(eyeglass(sassOptions)).on('error', sass.logError))
.pipe(prefix(["last 2 versions"]))
.pipe(sourcemaps.write())
.pipe(gulp.dest('css'))
.pipe(connect.reload())
})
//
// Dev server.
//
gulp.task('connect', function () {
connect.server({
livereload: true,
root: '.'
})
})
//
// Watch task.
//
gulp.task('watch', function () {
gulp.watch('src/sass/**/*.scss', ['styles:dev'])
gulp.watch('src/**/*.html', ['html:dev'])
gulp.watch('src/**/*.(png|jpe?g|gif|svg)', ['images:dev'])
})
//
// Task declarations.
//
gulp.task('dev', ['html:dev', 'images:dev', 'styles:dev', 'connect', 'watch'])
gulp.task('compile', ['html:dev', 'images:dev', 'styles:dev'])