diff --git a/gulpfile.js b/gulpfile.js index 724b0d54e98254f2d422c713c8fb259fd9ade881..46efaa338210bbaac2fad1af06048ee687e05be9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -44,6 +44,15 @@ function tweeCompilerExecutable() { 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) { return gulp.src(srcGlob) .pipe(sort()) @@ -126,18 +135,7 @@ function cleanupGit(cb) { } } -function compileStory() { - 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})); -} +gulp.task('compileStory', shell.task(tweeCompileCommand(), {env: cfg.options.twee.environment, verbose: true})); const processors = { "css": { @@ -189,9 +187,9 @@ function prepare(cb) { } if (fs.statSync('.git').isDirectory()) { - gulp.task('buildHTML', gulp.series(prepare, compileStory, cleanupGit)); + gulp.task('buildHTML', gulp.series(prepare, 'compileStory', cleanupGit)); } else { - gulp.task('buildHTML', gulp.series(prepare, compileStory)); + gulp.task('buildHTML', gulp.series(prepare, 'compileStory')); } exports.clean = clean;