Skip to content

Commit a5bee45

Browse files
committed
Fix Gulpfile on Windows
As mentionned on #40
1 parent 22c5a98 commit a5bee45

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

gulpfile.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
const util = require("util");
22
const path = require("path");
33

4-
const SRC = "./src";
5-
const DEST = "./dist";
4+
const SRC = path.join(__dirname, "./src");
5+
const DEST = path.join(__dirname, "./dist");
66

7-
const JS_DIR = path.join(SRC, "js/*.js");
8-
const SCSS_DIR = path.join(SRC, "scss/*.scss");
9-
const HTML_DIR = path.join(SRC, "*.html");
10-
const ASSETS_DIR = path.join(SRC, "assets/**/*");
11-
const LOCALES_DIR = path.join(SRC, "locales/*.json");
7+
const JS_DIR = "js/*.js";
8+
const SCSS_DIR = "scss/*.scss";
9+
const HTML_DIR = "*.html";
10+
const ASSETS_DIR = "assets/**/*";
11+
const LOCALES_DIR = "locales/*.json";
12+
13+
const OPTS = {
14+
cwd: SRC
15+
}
1216

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

4246
return pipeline(
43-
gulp.src(JS_DIR),
47+
gulp.src(JS_DIR, OPTS),
4448
webpack({
4549
mode,
4650
devtool: "source-map",
@@ -73,7 +77,7 @@ function css() {
7377
sass.compiler = require("node-sass");
7478

7579
return pipeline(
76-
gulp.src(SCSS_DIR),
80+
gulp.src(SCSS_DIR, OPTS),
7781
sourcemaps.init(),
7882
sass(),
7983
concat("style.css"),
@@ -89,22 +93,22 @@ function html() {
8993
const htmlmin = require("gulp-htmlmin");
9094

9195
return pipeline(
92-
gulp.src(HTML_DIR),
96+
gulp.src(HTML_DIR, OPTS),
9397
htmlmin({collapseWhitespace: true}),
9498
gulp.dest(DEST)
9599
)
96100
}
97101

98102
function assets() {
99103
return pipeline(
100-
gulp.src(ASSETS_DIR),
104+
gulp.src(ASSETS_DIR, OPTS),
101105
gulp.dest(DEST)
102106
);
103107
}
104108

105109
function locales() {
106110
return pipeline(
107-
gulp.src(LOCALES_DIR),
111+
gulp.src(LOCALES_DIR, OPTS),
108112
gulp.dest(path.join(DEST, "locales"))
109113
);
110114
}

0 commit comments

Comments
 (0)