Skip to content

Commit

Permalink
update to gulp v4
Browse files Browse the repository at this point in the history
  • Loading branch information
danwild committed Jul 11, 2019
1 parent 6b9ca43 commit fe953a9
Show file tree
Hide file tree
Showing 5 changed files with 3,169 additions and 743 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ It can be `m/s` for meter per second, `k/h` for kilometer per hour or `kt` for k

## Build / watch
```shell
gulp
npm run watch
```

## Reference
Expand Down
24 changes: 12 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const concat = require("gulp-concat");
const concatCss = require("gulp-concat-css");
const rename = require("gulp-rename");
const uglify = require("gulp-uglify");
const cssNano = require("gulp-cssnano");
const postCss = require("gulp-postcss");

// Concatenate & Minify src and dependencies
gulp.task("scripts", function() {
gulp.task("scripts", function () {
return gulp
.src(["src/js/**.js"])
.pipe(concat("leaflet-velocity.js"))
Expand All @@ -22,27 +22,27 @@ gulp.task("scripts", function() {
.pipe(gulp.dest("dist"));
});

gulp.task("concatCss", function() {
gulp.task("concatCss", function () {
return gulp
.src("./src/css/*.css")
.pipe(concatCss("leaflet-velocity.css"))
.pipe(gulp.dest("./dist"));
});

gulp.task("cssNano", ["concatCss"], function() {
gulp
gulp.task("postCss", function () {
return gulp
.src("./dist/leaflet-velocity.css")
.pipe(cssNano())
.pipe(postCss())
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest("./dist"));
});

// Default Task
gulp.task("default", ["scripts", "concatCss", "cssNano", "watch"]);

// Watch Files For Changes
gulp.task("watch", function() {
gulp.task("watch", function () {
// We watch both JS and HTML files.
gulp.watch("src/js/*.js", ["scripts"]);
gulp.watch("src/css/*.css", ["concatCss", "cssNano"]);
gulp.watch("src/js/*.js", gulp.series("scripts"));
gulp.watch("src/css/*.css", gulp.series("concatCss", "postCss"));
});

// Default Task
gulp.task('default', gulp.series("scripts", "concatCss", "postCss", "watch"));
Loading

0 comments on commit fe953a9

Please sign in to comment.