@@ -12,29 +12,30 @@ const plumber = require("gulp-plumber");
12
12
const rename = require ( "gulp-rename" ) ;
13
13
const sass = require ( "gulp-sass" ) ( require ( "sass" ) ) ;
14
14
const uglify = require ( "gulp-uglify" ) ;
15
- const babel = require ( 'gulp-babel' ) ;
16
- const concat = require ( 'gulp-concat' ) ;
17
-
15
+ const babel = require ( "gulp-babel" ) ;
16
+ const concat = require ( "gulp-concat" ) ;
18
17
19
18
// Load package.json for banner
20
- const pkg = require ( ' ./package.json' ) ;
19
+ const pkg = require ( " ./package.json" ) ;
21
20
22
21
// Set the banner content
23
- const banner = [ '/*!\n' ,
24
- ' * Start Bootstrap - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' ,
25
- ' * Copyright 2013-' + ( new Date ( ) ) . getFullYear ( ) , ' <%= pkg.author %>\n' ,
26
- ' * Licensed under <%= pkg.license %> (https://github.com/BlackrockDigital/<%= pkg.name %>/blob/master/LICENSE)\n' ,
27
- ' */\n' ,
28
- '\n'
29
- ] . join ( '' ) ;
22
+ const banner = [
23
+ "/*!\n" ,
24
+ " * Start Bootstrap - <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n" ,
25
+ " * Copyright 2013-" + new Date ( ) . getFullYear ( ) ,
26
+ " <%= pkg.author %>\n" ,
27
+ " * Licensed under <%= pkg.license %> (https://github.com/BlackrockDigital/<%= pkg.name %>/blob/master/LICENSE)\n" ,
28
+ " */\n" ,
29
+ "\n" ,
30
+ ] . join ( "" ) ;
30
31
31
32
// BrowserSync
32
33
function browserSync ( done ) {
33
34
browsersync . init ( {
34
35
server : {
35
- baseDir : "./"
36
+ baseDir : "./" ,
36
37
} ,
37
- port : 3000
38
+ port : 3000 ,
38
39
} ) ;
39
40
done ( ) ;
40
41
}
@@ -53,84 +54,108 @@ function clean() {
53
54
// Bring third party dependencies from node_modules into vendor directory
54
55
function modules ( ) {
55
56
// Bootstrap
56
- var bootstrap = gulp . src ( './node_modules/bootstrap/dist/**/*' )
57
- . pipe ( gulp . dest ( './vendor/bootstrap' ) ) ;
57
+ var bootstrap = gulp
58
+ . src ( "./node_modules/bootstrap/dist/**/*" )
59
+ . pipe ( gulp . dest ( "./vendor/bootstrap" ) ) ;
58
60
// Font Awesome CSS
59
- var fontAwesomeCSS = gulp . src ( './node_modules/@fortawesome/fontawesome-free/css/**/*' )
60
- . pipe ( gulp . dest ( './vendor/fontawesome-free/css' ) ) ;
61
+ var fontAwesomeCSS = gulp
62
+ . src ( "./node_modules/@fortawesome/fontawesome-free/css/**/*" )
63
+ . pipe ( gulp . dest ( "./vendor/fontawesome-free/css" ) ) ;
61
64
// Font Awesome Webfonts
62
- var fontAwesomeWebfonts = gulp . src ( './node_modules/@fortawesome/fontawesome-free/webfonts/**/*' )
63
- . pipe ( gulp . dest ( './vendor/fontawesome-free/webfonts' ) ) ;
65
+ var fontAwesomeWebfonts = gulp
66
+ . src ( "./node_modules/@fortawesome/fontawesome-free/webfonts/**/*" )
67
+ . pipe ( gulp . dest ( "./vendor/fontawesome-free/webfonts" ) ) ;
64
68
// jQuery Easing
65
- var jqueryEasing = gulp . src ( './node_modules/jquery.easing/*.js' )
66
- . pipe ( gulp . dest ( './vendor/jquery-easing' ) ) ;
69
+ var jqueryEasing = gulp
70
+ . src ( "./node_modules/jquery.easing/*.js" )
71
+ . pipe ( gulp . dest ( "./vendor/jquery-easing" ) ) ;
67
72
// jQuery
68
- var jquery = gulp . src ( [
69
- './node_modules/jquery/dist/*' ,
70
- '!./node_modules/jquery/dist/core.js'
71
- ] )
72
- . pipe ( gulp . dest ( './vendor/jquery' ) ) ;
73
- return merge ( bootstrap , fontAwesomeCSS , fontAwesomeWebfonts , jquery , jqueryEasing ) ;
73
+ var jquery = gulp
74
+ . src ( [
75
+ "./node_modules/jquery/dist/*" ,
76
+ "!./node_modules/jquery/dist/core.js" ,
77
+ ] )
78
+ . pipe ( gulp . dest ( "./vendor/jquery" ) ) ;
79
+ return merge (
80
+ bootstrap ,
81
+ fontAwesomeCSS ,
82
+ fontAwesomeWebfonts ,
83
+ jquery ,
84
+ jqueryEasing
85
+ ) ;
74
86
}
75
87
76
88
// CSS task
77
89
function css ( ) {
78
90
return gulp
79
91
. src ( "./scss/**/*.scss" )
80
92
. pipe ( plumber ( ) )
81
- . pipe ( sass ( {
82
- outputStyle : "expanded" ,
83
- includePaths : "./node_modules" ,
84
- } ) )
93
+ . pipe (
94
+ sass ( {
95
+ outputStyle : "expanded" ,
96
+ includePaths : "./node_modules" ,
97
+ } )
98
+ )
85
99
. on ( "error" , sass . logError )
86
100
. pipe (
87
101
autoprefixer ( {
88
102
cascade : false ,
89
103
} )
90
104
)
105
+ . pipe (
106
+ header ( banner , {
107
+ pkg : pkg ,
108
+ } )
109
+ )
91
110
. pipe ( gulp . dest ( "./css" ) )
92
- . pipe ( rename ( {
93
- suffix : ".min"
94
- } ) )
111
+ . pipe (
112
+ rename ( {
113
+ suffix : ".min" ,
114
+ } )
115
+ )
95
116
. pipe ( cleanCSS ( ) )
96
117
. pipe ( gulp . dest ( "./css" ) )
97
118
. pipe ( browsersync . stream ( ) ) ;
98
119
}
99
120
100
121
function html ( ) {
101
- return gulp . src ( [
102
- 'html/_head.html' ,
103
- 'html/_home.html' ,
104
- 'html/_compute.html' ,
105
- 'html/_publish.html' ,
106
- 'html/_learn.html' ,
107
- 'html/_act.html' ,
108
- 'html/_about.html' ,
109
- 'html/_authors.html' ,
110
- 'html/_foot.html' ,
111
- ] )
112
- . pipe ( concat ( 'index.html' ) )
113
- . pipe ( gulp . dest ( './' ) ) ;
122
+ return gulp
123
+ . src ( [
124
+ "html/_head.html" ,
125
+ "html/_home.html" ,
126
+ "html/_compute.html" ,
127
+ "html/_publish.html" ,
128
+ "html/_learn.html" ,
129
+ "html/_act.html" ,
130
+ "html/_about.html" ,
131
+ "html/_authors.html" ,
132
+ "html/_foot.html" ,
133
+ ] )
134
+ . pipe ( concat ( "index.html" ) )
135
+ . pipe ( gulp . dest ( "./" ) ) ;
114
136
}
115
137
116
138
// JS task
117
139
function js ( ) {
118
140
return gulp
119
- . src ( [
120
- './js/*.js' ,
121
- '!./js/*.min.js'
122
- ] )
123
- . pipe ( babel ( {
124
- presets : [ "@babel/preset-env" ]
125
- } ) )
141
+ . src ( [ "./js/*.js" , "!./js/*.min.js" ] )
142
+ . pipe (
143
+ babel ( {
144
+ presets : [ "@babel/preset-env" ] ,
145
+ } )
146
+ )
126
147
. pipe ( uglify ( ) )
127
- . pipe ( header ( banner , {
128
- pkg : pkg
129
- } ) )
130
- . pipe ( rename ( {
131
- suffix : '.min'
132
- } ) )
133
- . pipe ( gulp . dest ( './js' ) )
148
+ . pipe (
149
+ header ( banner , {
150
+ pkg : pkg ,
151
+ } )
152
+ )
153
+ . pipe (
154
+ rename ( {
155
+ suffix : ".min" ,
156
+ } )
157
+ )
158
+ . pipe ( gulp . dest ( "./js" ) )
134
159
. pipe ( browsersync . stream ( ) ) ;
135
160
}
136
161
0 commit comments