-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
103 lines (87 loc) · 2.63 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var gulp = require( 'gulp' ),
plumber = require( 'gulp-plumber' ),
watch = require( 'gulp-watch' ),
livereload = require( 'gulp-livereload' ),
minifycss = require( 'gulp-minify-css' ),
jshint = require( 'gulp-jshint' ),
stylish = require( 'jshint-stylish' ),
uglify = require( 'gulp-uglify' ),
rename = require( 'gulp-rename' ),
notify = require( 'gulp-notify' ),
include = require( 'gulp-include' ),
stylus = require('gulp-stylus'),
rupture = require('rupture'),
sass = require( 'gulp-sass' );
var server = require('gulp-server-livereload');
var onError = function( err ) {
console.log( 'An error occurred:', err.message );
this.emit( 'end' );
}
gulp.task('webserver', function() {
gulp.src('app')
.pipe(server({
livereload: true,
directoryListing: false,
open: true,
fallback: './app/index.html'
}));
});
gulp.task( 'stylus', function() {
return gulp.src('stylus/main.styl')
.pipe(stylus({
compress: false,
paths: ['stylus'],
use: [rupture()]
}))
.pipe(rename('style.css'))
.pipe(gulp.dest('./app'))
.pipe(livereload())
.pipe(minifycss())
.pipe( rename( { suffix: '.min' } ) )
.pipe(gulp.dest('./app'))
.pipe(livereload());
/*
return gulp.src( './scss/style.scss' )
.pipe( plumber( { errorHandler: onError } ) )
.pipe( sass() )
.pipe( gulp.dest( './app' ) )
.pipe( minifycss() )
.pipe( rename( { suffix: '.min' } ) )
.pipe( gulp.dest( './app' ) )
.pipe( livereload() );*/
} );
gulp.task( 'js', function() {
return gulp.src('js/*.js')
.pipe(gulp.dest('./app/js'))
.pipe(livereload())
} );
gulp.task( 'img', function() {
return gulp.src('img/*')
.pipe(gulp.dest('./app/img'))
.pipe(livereload())
} );
gulp.task( 'html', function() {
return gulp.src('./html/*.html')
.pipe(gulp.dest('./app'))
.pipe(livereload())
});
gulp.task( 'fonts', function() {
return gulp.src('./fonts/**')
.pipe(gulp.dest('./app/fonts'))
});
gulp.task( 'bower_components', function() {
return gulp.src('./bower_components/**')
.pipe(gulp.dest('./app/bower_components'))
});
gulp.task( 'watch', function() {
livereload.listen();
gulp.watch( './stylus/*.styl', [ 'stylus' ] );
gulp.watch( './img/**', [ 'img' ] );
gulp.watch( './js/**', [ 'js' ] );
gulp.watch( './html/**/*.html', [ 'html' ] );
gulp.watch( './app/**/*.html' ).on( 'change', function( file ) {
livereload.changed( file );
} );
} );
gulp.task( 'default', [ 'js','stylus', 'img','watch','html', 'fonts', 'bower_components' ], function() {
} );