Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6b66fa3

Browse files
author
AbdelrahmanSE
committed
Add support for ES6 & Babel for Gulp
1 parent b69901c commit 6b66fa3

File tree

3 files changed

+1324
-20
lines changed

3 files changed

+1324
-20
lines changed

‎gulpfile.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var webserver = require("gulp-webserver");
1616
var del = require("del");
1717
var sass = require("gulp-sass");
1818
var jshint = require("gulp-jshint");
19+
var babel = require("gulp-babel");
1920
var sourcemaps = require("gulp-sourcemaps");
2021
var browserify = require("browserify");
2122
var source = require("vinyl-source-stream");
@@ -27,7 +28,6 @@ var CacheBuster = require("gulp-cachebust");
2728
const livereload = require("gulp-livereload");
2829
var cachebust = new CacheBuster();
2930

30-
3131
/**
3232
* jshint task
3333
*/
@@ -40,7 +40,6 @@ gulp.task("jshint", function(cb) {
4040
cb();
4141
});
4242

43-
4443
/**
4544
* Deletes the dist folder
4645
*/
@@ -49,26 +48,22 @@ gulp.task("clean", function(cb) {
4948
del(["dist"]).then(() => cb());
5049
});
5150

52-
5351
/**
5452
* Sub Cleaning Tasks
5553
*/
5654

5755
gulp.task("clean-build-js", function(cb) {
58-
del(["./dist/bundle.*"]).then(() => cb());
56+
del(["./dist/bundle.*"]).then(() => cb());
5957
});
6058

61-
6259
gulp.task("clean-build-css", function(cb) {
6360
del(["./dist/style.*"]).then(() => cb());
6461
});
6562

66-
6763
gulp.task("clean-build-template-cache", function(cb) {
6864
del(["./dist/partials.*"]).then(() => cb());
6965
});
7066

71-
7267
/**
7368
* Builds SCSS files
7469
*/
@@ -88,7 +83,6 @@ gulp.task("build-css", function(cb) {
8883
.pipe(livereload());
8984
});
9085

91-
9286
/**
9387
* Build a minified Javascript bundle
9488
*/
@@ -106,15 +100,23 @@ gulp.task("build-js", function(cb) {
106100
.pipe(source("bundle.js"))
107101
.pipe(buffer())
108102
.pipe(cachebust.resources())
109-
.pipe(sourcemaps.init({ loadMaps: true }))
103+
.pipe(
104+
sourcemaps.init({
105+
loadMaps: true
106+
})
107+
)
108+
.pipe(
109+
babel({
110+
presets: ["@babel/env"]
111+
})
112+
)
110113
.pipe(uglify())
111114
.on("error", gutil.log)
112115
.pipe(sourcemaps.write("./maps"))
113116
.pipe(gulp.dest("./dist"))
114117
.pipe(livereload());
115118
});
116119

117-
118120
/**
119121
* Fills in the Angular template cache
120122
*/
@@ -133,14 +135,17 @@ gulp.task("build-template-cache", function(cb) {
133135
)
134136
.pipe(concat("partials.js"))
135137
.pipe(cachebust.resources())
136-
.pipe(sourcemaps.init({ loadMaps: true }))
138+
.pipe(
139+
sourcemaps.init({
140+
loadMaps: true
141+
})
142+
)
137143
.pipe(uglify())
138144
.pipe(sourcemaps.write("./maps"))
139145
.pipe(gulp.dest("./dist/"))
140146
.pipe(livereload());
141147
});
142148

143-
144149
/**
145150
* CacheBust References
146151
*/
@@ -153,7 +158,6 @@ gulp.task("code-cache-bust", function(cb) {
153158
cb();
154159
});
155160

156-
157161
/**
158162
* Build Task
159163
*/
@@ -183,7 +187,12 @@ gulp.task(
183187
);
184188
gulp.watch(
185189
"./src/modules/**/*.view.html",
186-
gulp.series(["clean-build-template-cache", "jshint", "build-template-cache", "code-cache-bust"])
190+
gulp.series([
191+
"clean-build-template-cache",
192+
"jshint",
193+
"build-template-cache",
194+
"code-cache-bust"
195+
])
187196
);
188197
gulp.watch(
189198
"./src/assets/scss/*",
@@ -193,7 +202,6 @@ gulp.task(
193202
})
194203
);
195204

196-
197205
/**
198206
* Launches a Webserver
199207
*/
@@ -208,7 +216,6 @@ gulp.task("webserver", function() {
208216
);
209217
});
210218

211-
212219
/**
213220
* Start the Dev Server
214221
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /