-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (54 loc) · 1.59 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
// Directories
var _assets = 'assets/',
_sheets = 'sass/';
// Gulp dependencies
var gulp = require('gulp'),
autoprefixer= require('gulp-autoprefixer'),
sass = require('gulp-ruby-sass'),
minify = require('gulp-minify-css'),
livereload = require('gulp-livereload'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
install = require('gulp-install');
// Server
var express = require('express'),
app = express();
// Installs all bower components
gulp.task('install', function() {
return gulp.src(['./bower.json'])
.pipe(install())
.pipe(notify({ message: 'Bower components installed!' }));
});
// Run SaSS tasks
gulp.task('sass', function() {
return gulp.src(_sheets + 'default/main.scss')
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 11', 'ios 6', 'android 4'))
.pipe(rename({ suffix: '.min' }))
// .pipe(minify())
.pipe(gulp.dest(_assets + 'css'))
.pipe(livereload())
.pipe(notify({ message: 'SaSS tasks finished!' }));
});
// Static server with express
gulp.task('server', function() {
app.use(express.static(__dirname));
var server = app.listen(8080, function() {
console.log('Listening on port %d', server.address().port);
});
})
// Default task
gulp.task('default', function() {
// gulp.run('install');
gulp.run('sass');
gulp.run('server');
gulp.watch([_sheets + 'default/**/*.scss', _sheets + 'default/*.scss'], ['sass']);
gulp.watch('./index.html')
.on('change', function(file) {
livereload().changed(file.path);
});
gulp.watch('./button.html')
.on('change', function(file) {
livereload().changed(file.path);
});
})