Skip to content
Snippets Groups Projects
Commit c661b5c9 authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'gulp-fix' into 'pregmod-master'

gulpfile: do not run tweego three times in a row

See merge request pregmodfan/fc-pregmod!9092
parents 8e11cf9d 6a34320e
No related branches found
No related tags found
1 merge request!9092gulpfile: do not run tweego three times in a row
...@@ -44,6 +44,15 @@ function tweeCompilerExecutable() { ...@@ -44,6 +44,15 @@ function tweeCompilerExecutable() {
return res; return res;
} }
function tweeCompileCommand() {
let sources = [path.join(cfg.dirs.intermediate, "story")];
sources.push(...cfg.sources.story.media);
let modules = [path.join(cfg.dirs.intermediate, "module")];
let moduleArgs = modules.map(fn => `--module=${fn}`);
return `${tweeCompilerExecutable()} -f ${cfg.twineformat} --head=${cfg.sources.head} -o ${path.join(cfg.dirs.intermediate, htmlOut)} ${moduleArgs.join(' ')} ${sources.join(' ')}`;
}
function concatFiles(srcGlob, destDir, destFileName) { function concatFiles(srcGlob, destDir, destFileName) {
return gulp.src(srcGlob) return gulp.src(srcGlob)
.pipe(sort()) .pipe(sort())
...@@ -126,18 +135,7 @@ function cleanupGit(cb) { ...@@ -126,18 +135,7 @@ function cleanupGit(cb) {
} }
} }
function compileStory() { gulp.task('compileStory', shell.task(tweeCompileCommand(), {env: cfg.options.twee.environment, verbose: true}));
let sources = [path.join(cfg.dirs.intermediate, "story")];
sources.push(...cfg.sources.story.media);
let modules = [path.join(cfg.dirs.intermediate, "module")];
let moduleArgs = modules.map(fn => `--module=${fn}`);
const cmdLine = `${tweeCompilerExecutable()} -f ${cfg.twineformat} --head=${cfg.sources.head} -o ${path.join(cfg.dirs.intermediate, htmlOut)} ${moduleArgs.join(' ')} ${sources.join(' ')}`;
log.info(cmdLine);
return gulp.src(sources, {read: false})
.pipe(shell(cmdLine, {env: cfg.options.twee.environment}));
}
const processors = { const processors = {
"css": { "css": {
...@@ -189,9 +187,9 @@ function prepare(cb) { ...@@ -189,9 +187,9 @@ function prepare(cb) {
} }
if (fs.statSync('.git').isDirectory()) { if (fs.statSync('.git').isDirectory()) {
gulp.task('buildHTML', gulp.series(prepare, compileStory, cleanupGit)); gulp.task('buildHTML', gulp.series(prepare, 'compileStory', cleanupGit));
} else { } else {
gulp.task('buildHTML', gulp.series(prepare, compileStory)); gulp.task('buildHTML', gulp.series(prepare, 'compileStory'));
} }
exports.clean = clean; exports.clean = clean;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment