Skip to content

Commit

Permalink
Fix Gulpfile on Windows
Browse files Browse the repository at this point in the history
As mentionned on #40
  • Loading branch information
Pizzacus committed Mar 13, 2019
1 parent 22c5a98 commit a5bee45
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
const util = require("util");
const path = require("path");

const SRC = "./src";
const DEST = "./dist";
const SRC = path.join(__dirname, "./src");
const DEST = path.join(__dirname, "./dist");

const JS_DIR = path.join(SRC, "js/*.js");
const SCSS_DIR = path.join(SRC, "scss/*.scss");
const HTML_DIR = path.join(SRC, "*.html");
const ASSETS_DIR = path.join(SRC, "assets/**/*");
const LOCALES_DIR = path.join(SRC, "locales/*.json");
const JS_DIR = "js/*.js";
const SCSS_DIR = "scss/*.scss";
const HTML_DIR = "*.html";
const ASSETS_DIR = "assets/**/*";
const LOCALES_DIR = "locales/*.json";

const OPTS = {
cwd: SRC
}

// Polyfill of the future stream.pipeline API
// Can be changed when Node 10.0.0 hits LTS
Expand Down Expand Up @@ -40,7 +44,7 @@ function js() {
const uglify = require("gulp-uglify");

return pipeline(
gulp.src(JS_DIR),
gulp.src(JS_DIR, OPTS),
webpack({
mode,
devtool: "source-map",
Expand Down Expand Up @@ -73,7 +77,7 @@ function css() {
sass.compiler = require("node-sass");

return pipeline(
gulp.src(SCSS_DIR),
gulp.src(SCSS_DIR, OPTS),
sourcemaps.init(),
sass(),
concat("style.css"),
Expand All @@ -89,22 +93,22 @@ function html() {
const htmlmin = require("gulp-htmlmin");

return pipeline(
gulp.src(HTML_DIR),
gulp.src(HTML_DIR, OPTS),
htmlmin({collapseWhitespace: true}),
gulp.dest(DEST)
)
}

function assets() {
return pipeline(
gulp.src(ASSETS_DIR),
gulp.src(ASSETS_DIR, OPTS),
gulp.dest(DEST)
);
}

function locales() {
return pipeline(
gulp.src(LOCALES_DIR),
gulp.src(LOCALES_DIR, OPTS),
gulp.dest(path.join(DEST, "locales"))
);
}
Expand Down

0 comments on commit a5bee45

Please sign in to comment.