Skip to content

Commit

Permalink
add node 15 support for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLoy committed Nov 25, 2020
1 parent 3d9c3d2 commit 37a4467
Show file tree
Hide file tree
Showing 6 changed files with 810 additions and 547 deletions.
2 changes: 1 addition & 1 deletion css/demo.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/simplyCountdown.theme.default.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/simplyCountdown.theme.losange.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 29 additions & 45 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,44 @@ const cssCompressor = require("gulp-csso");
const terser = require("gulp-terser");
const eslint = require("gulp-eslint");
const saveLicense = require("uglify-save-license");
const browserSync = require("browser-sync");
const browserSync = require("browser-sync").create();
const concat = require("gulp-concat");
const reload = browserSync.reload;
const browserChoice = "default";

/**
* Build the demo sass styles
*/
gulp.task("build:scss:demo", function () {
function buildScssDemo() {
return gulp.src("css/scss/demo.scss")
.pipe(sass({
precision: 10
}).on("error", sass.logError))
.pipe(autoprefixer({
browsers: ["last 2 versions"],
cascade: false,
}))
.pipe(autoprefixer())
.pipe(cssCompressor({
restructure: false
}))
.pipe(gulp.dest("css"));
});
}

/**
* Build the themes sass styles
*/
gulp.task("build:scss:themes", function () {
function buildScssThemes() {
return gulp.src("css/scss/simplyCountdown.theme.*.scss")
.pipe(sass({
precision: 10
}).on("error", sass.logError))
.pipe(autoprefixer({
browsers: ["last 2 versions"],
cascade: false,
}))
.pipe(autoprefixer())
.pipe(cssCompressor({
restructure: false
}))
.pipe(gulp.dest("css"));
});
}

/**
* Transpile the lib from es6 to es5
*/
gulp.task("build:es6", ["lint:es6"], function () {
function buildEs6() {
return gulp.src("dev/simplyCountdown.js")
.pipe(concat("simplyCountdown.min.js"))
.pipe(babel({
Expand All @@ -66,39 +59,33 @@ gulp.task("build:es6", ["lint:es6"], function () {
}
}))
.pipe(gulp.dest("dist"));
});

}

gulp.task("lint:es6", function () {
function lintEs6() {
return gulp.src("dev/simplyCountdown.js")
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
});
.pipe(eslint.failAfterError());
}

gulp.task("lint:no-break:es6", function () {
function lintNoBreakEs6() {
return gulp.src("dev/simplyCountdown.js")
.pipe(eslint())
.pipe(eslint.format())
});

/**
* BUILD
* Build everything Sass & JS
*/
gulp.task("build", [
"build:scss:demo",
"build:scss:themes",
"build:es6",
]);
.pipe(eslint.format());
}


/**
* SERVE
* Take a coffee, relax, and write some code
*/
gulp.task("serve", ["build:scss:demo", "build:scss:themes", "lint:no-break:es6"], function () {
browserSync({
function reload(done) {
browserSync.reload();
done();
}

function serve() {
browserSync.init({
notify: true,
port: 9000,
reloadDelay: 100,
Expand All @@ -108,14 +95,11 @@ gulp.task("serve", ["build:scss:demo", "build:scss:themes", "lint:no-break:es6"]
}
});

gulp.watch("dev/**/*.js", ["build:es6"])
.on("change", reload);

gulp.watch("css/scss/**/*", ["build:scss:demo", "build:scss:themes"])
.on("change", reload);

gulp.watch("./**/*.html")
.on("change", reload);
});
gulp.watch("dev/**/*.js", gulp.series(lintNoBreakEs6, buildEs6, reload));
gulp.watch("css/scss/**/*", gulp.series(buildScssDemo, buildScssThemes, reload));
gulp.watch("./**/*.html", gulp.series(reload));
}

gulp.task("default", ["serve"]);
exports.default = gulp.series(buildScssDemo, buildScssThemes, lintNoBreakEs6, buildEs6, serve);
exports.serve = gulp.series(buildScssDemo, buildScssThemes, lintNoBreakEs6, buildEs6, serve);
exports.build = gulp.series(buildScssDemo, buildScssThemes, lintEs6, buildEs6);
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@
"url": "https://github.com/VincentLoy/simplyCountdown.js/issues"
},
"license": "MIT",
"browserslist": [
"defaults"
],
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"browser-sync": "^2.26.3",
"core-js": "^2.5.7",
"eslint-config-airbnb-base": "^13.1.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^6.0.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-babel": "^8.0.0",
"gulp-concat": "^2.6.1",
"gulp-csso": "^3.0.1",
Expand Down
Loading

0 comments on commit 37a4467

Please sign in to comment.