@@ -10,28 +10,30 @@ const header = require("gulp-header");
10
10
const merge = require ( "merge-stream" ) ;
11
11
const plumber = require ( "gulp-plumber" ) ;
12
12
const rename = require ( "gulp-rename" ) ;
13
- const sass = require ( "gulp-sass" ) ;
13
+ const sass = require ( "gulp-sass" ) ( require ( "sass" ) ) ;
14
14
const uglify = require ( "gulp-uglify" ) ;
15
15
16
16
// Load package.json for banner
17
- const pkg = require ( ' ./package.json' ) ;
17
+ const pkg = require ( " ./package.json" ) ;
18
18
19
19
// Set the banner content
20
- const banner = [ '/*!\n' ,
21
- ' * Start Bootstrap - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' ,
22
- ' * Copyright 2013-' + ( new Date ( ) ) . getFullYear ( ) , ' <%= pkg.author %>\n' ,
23
- ' * Licensed under <%= pkg.license %> (https://github.com/BlackrockDigital/<%= pkg.name %>/blob/master/LICENSE)\n' ,
24
- ' */\n' ,
25
- '\n'
26
- ] . join ( '' ) ;
20
+ const banner = [
21
+ "/*!\n" ,
22
+ " * Start Bootstrap - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n" ,
23
+ " * Copyright 2013-" + new Date ( ) . getFullYear ( ) ,
24
+ " <%= pkg.author %>\n" ,
25
+ " * Licensed under <%= pkg.license %> (https://github.com/BlackrockDigital/<%= pkg.name %>/blob/master/LICENSE)\n" ,
26
+ " */\n" ,
27
+ "\n" ,
28
+ ] . join ( "" ) ;
27
29
28
30
// BrowserSync
29
31
function browserSync ( done ) {
30
32
browsersync . init ( {
31
33
server : {
32
- baseDir : "./"
34
+ baseDir : "./" ,
33
35
} ,
34
- port : 3000
36
+ port : 3000 ,
35
37
} ) ;
36
38
done ( ) ;
37
39
}
@@ -50,23 +52,28 @@ function clean() {
50
52
// Bring third party dependencies from node_modules into vendor directory
51
53
function modules ( ) {
52
54
// Bootstrap JS
53
- var bootstrap = gulp . src ( './node_modules/bootstrap/dist/js/**/*' )
54
- . pipe ( gulp . dest ( './vendor/bootstrap/js' ) ) ;
55
+ var bootstrap = gulp
56
+ . src ( "./node_modules/bootstrap/dist/js/**/*" )
57
+ . pipe ( gulp . dest ( "./vendor/bootstrap/js" ) ) ;
55
58
// Font Awesome
56
- var fontAwesome = gulp . src ( './node_modules/@fortawesome/**/*' )
57
- . pipe ( gulp . dest ( './vendor' ) ) ;
59
+ var fontAwesome = gulp
60
+ . src ( "./node_modules/@fortawesome/**/*" )
61
+ . pipe ( gulp . dest ( "./vendor" ) ) ;
58
62
// jQuery Easing
59
- var jqueryEasing = gulp . src ( './node_modules/jquery.easing/*.js' )
60
- . pipe ( gulp . dest ( './vendor/jquery-easing' ) ) ;
63
+ var jqueryEasing = gulp
64
+ . src ( "./node_modules/jquery.easing/*.js" )
65
+ . pipe ( gulp . dest ( "./vendor/jquery-easing" ) ) ;
61
66
// Magnific Popup
62
- var magnificPopup = gulp . src ( './node_modules/magnific-popup/dist/*' )
63
- . pipe ( gulp . dest ( './vendor/magnific-popup' ) ) ;
67
+ var magnificPopup = gulp
68
+ . src ( "./node_modules/magnific-popup/dist/*" )
69
+ . pipe ( gulp . dest ( "./vendor/magnific-popup" ) ) ;
64
70
// jQuery
65
- var jquery = gulp . src ( [
66
- './node_modules/jquery/dist/*' ,
67
- '!./node_modules/jquery/dist/core.js'
71
+ var jquery = gulp
72
+ . src ( [
73
+ "./node_modules/jquery/dist/*" ,
74
+ "!./node_modules/jquery/dist/core.js" ,
68
75
] )
69
- . pipe ( gulp . dest ( ' ./vendor/jquery' ) ) ;
76
+ . pipe ( gulp . dest ( " ./vendor/jquery" ) ) ;
70
77
return merge ( bootstrap , fontAwesome , jquery , jqueryEasing , magnificPopup ) ;
71
78
}
72
79
@@ -75,22 +82,30 @@ function css() {
75
82
return gulp
76
83
. src ( "./scss/**/*.scss" )
77
84
. pipe ( plumber ( ) )
78
- . pipe ( sass ( {
79
- outputStyle : "expanded" ,
80
- includePaths : "./node_modules" ,
81
- } ) )
85
+ . pipe (
86
+ sass ( {
87
+ outputStyle : "expanded" ,
88
+ includePaths : "./node_modules" ,
89
+ } )
90
+ )
82
91
. on ( "error" , sass . logError )
83
- . pipe ( autoprefixer ( {
84
- browsers : [ 'last 2 versions' ] ,
85
- cascade : false
86
- } ) )
87
- . pipe ( header ( banner , {
88
- pkg : pkg
89
- } ) )
92
+ . pipe (
93
+ autoprefixer ( {
94
+ browsers : [ "last 2 versions" ] ,
95
+ cascade : false ,
96
+ } )
97
+ )
98
+ . pipe (
99
+ header ( banner , {
100
+ pkg : pkg ,
101
+ } )
102
+ )
90
103
. pipe ( gulp . dest ( "./css" ) )
91
- . pipe ( rename ( {
92
- suffix : ".min"
93
- } ) )
104
+ . pipe (
105
+ rename ( {
106
+ suffix : ".min" ,
107
+ } )
108
+ )
94
109
. pipe ( cleanCSS ( ) )
95
110
. pipe ( gulp . dest ( "./css" ) )
96
111
. pipe ( browsersync . stream ( ) ) ;
@@ -99,18 +114,19 @@ function css() {
99
114
// JS task
100
115
function js ( ) {
101
116
return gulp
102
- . src ( [
103
- './js/*.js' ,
104
- '!./js/*.min.js'
105
- ] )
117
+ . src ( [ "./js/*.js" , "!./js/*.min.js" ] )
106
118
. pipe ( uglify ( ) )
107
- . pipe ( header ( banner , {
108
- pkg : pkg
109
- } ) )
110
- . pipe ( rename ( {
111
- suffix : '.min'
112
- } ) )
113
- . pipe ( gulp . dest ( './js' ) )
119
+ . pipe (
120
+ header ( banner , {
121
+ pkg : pkg ,
122
+ } )
123
+ )
124
+ . pipe (
125
+ rename ( {
126
+ suffix : ".min" ,
127
+ } )
128
+ )
129
+ . pipe ( gulp . dest ( "./js" ) )
114
130
. pipe ( browsersync . stream ( ) ) ;
115
131
}
116
132
0 commit comments