Skip to content

Commit e43c976

Browse files
committed
format
1 parent d781e41 commit e43c976

File tree

1 file changed

+86
-61
lines changed

1 file changed

+86
-61
lines changed

gulpfile.babel.js

+86-61
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,30 @@ const plumber = require("gulp-plumber");
1212
const rename = require("gulp-rename");
1313
const sass = require("gulp-sass")(require("sass"));
1414
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");
1817

1918
// Load package.json for banner
20-
const pkg = require('./package.json');
19+
const pkg = require("./package.json");
2120

2221
// 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("");
3031

3132
// BrowserSync
3233
function browserSync(done) {
3334
browsersync.init({
3435
server: {
35-
baseDir: "./"
36+
baseDir: "./",
3637
},
37-
port: 3000
38+
port: 3000,
3839
});
3940
done();
4041
}
@@ -53,84 +54,108 @@ function clean() {
5354
// Bring third party dependencies from node_modules into vendor directory
5455
function modules() {
5556
// 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"));
5860
// 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"));
6164
// 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"));
6468
// 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"));
6772
// 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+
);
7486
}
7587

7688
// CSS task
7789
function css() {
7890
return gulp
7991
.src("./scss/**/*.scss")
8092
.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+
)
8599
.on("error", sass.logError)
86100
.pipe(
87101
autoprefixer({
88102
cascade: false,
89103
})
90104
)
105+
.pipe(
106+
header(banner, {
107+
pkg: pkg,
108+
})
109+
)
91110
.pipe(gulp.dest("./css"))
92-
.pipe(rename({
93-
suffix: ".min"
94-
}))
111+
.pipe(
112+
rename({
113+
suffix: ".min",
114+
})
115+
)
95116
.pipe(cleanCSS())
96117
.pipe(gulp.dest("./css"))
97118
.pipe(browsersync.stream());
98119
}
99120

100121
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("./"));
114136
}
115137

116138
// JS task
117139
function js() {
118140
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+
)
126147
.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"))
134159
.pipe(browsersync.stream());
135160
}
136161

0 commit comments

Comments
 (0)