Gulp command must be run two time
See original GitHub issueHello,
At the first launch of the compilation, Gulp does not generate the files dependent on other generated files.
ex:
- o = h + cpp
- o = h + cpp
- lib = o + o
You must run the Gulp command a second time I can not find the problem
I have this gulpfile:
var SRC_DIR = 'src'
var EXCLUDE_DOT = `!${SRC_DIR}/**/.*`
var BUILD_DIR = 'dist/.tmp'
var DIST_DIR = 'dist'
const PP_OPTS = { NODE_ENV: 'production', DEBUG: false}
// 1) compiler les fichiers un par un sauf le tag
// 2) les placer avec le tag dans un dossier tmp
// 3) compiler le tag
gulp.task('default', [ 'mv_exclude', 'mv_tag', 'js', 'tag'])
gulp.task('mv_exclude', function()
{
gulp.src(`${EXCLUDE_DOT}/*`,
{ base: SRC_DIR})
.pipe(gulp.dest(BUILD_DIR))
})
gulp.task('js', function()
{
gulp.src([`${SRC_DIR}/**/*.js`, EXCLUDE_DOT],
{ base: SRC_DIR})
.pipe(
babel({ presets: ['es2015'] })
)
.pipe(gulp.dest(BUILD_DIR))
})
gulp.task('mv_tag', function()
{
gulp.src([`${SRC_DIR}/**/*.tag`, EXCLUDE_DOT],
{ base: SRC_DIR})
.pipe(gulp.dest(BUILD_DIR))
})
gulp.task('tag', function()
{
gulp.src([`${BUILD_DIR}/**/*.tag`, EXCLUDE_DOT],
{ base: BUILD_DIR})
.pipe(
riot()
)
.pipe(
concat('bundle.js')
)
.pipe(
preprocess({ context: PP_OPTS, extension: 'js' } )
)
.pipe(
minify({ext:{ min:'.min.js'}})
)
.pipe(gulp.dest(DIST_DIR))
})
At the first launch:
And the second time
And I have no error or notice. I also searched here, but nothing … Did I make a mistake orr is this a bug?
This has already happened and every time this happens when I move files to avoid file name conflis
Merci !
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Gulp.js, watch task runs twice when saving files - Stack Overflow
Gulp.js, watch task runs twice when saving files · With that exact same code, it runs only once for me. · My guess...
Read more >Using it with gulp-watch, runs multiple times · Issue #6 - GitHub
Every time I save a test file, it adds the files to the stack and runs that many times. The below result is...
Read more >Quick Start | gulp.js
To run multiple tasks, you can use gulp <task> <othertask> . Result#. The default task will run and do nothing. Output: Starting default...
Read more >Getting Started with Gulp.js - Semaphore Tutorial
Learn how to set up and use Gulp.js, a task runner for Node.js based ... It only needs to read a file once,...
Read more >Gulp for WordPress: Initial Setup - CSS-Tricks
The reason we need to delineate between the two is that some details in our tasks will be time and memory-consuming, which only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You should be returning the stream in in your tasks. Where you have
gulp.src(...
change it toreturn gulp.src(...
. This notifies gulp that the task is using a stream and to wait for it to end.If this doesn’t help, there’s probably something else wrong in a plugin. Either way, this isn’t a gulp issue and you could find more help on Stack Overflow.
This is not a bug.
See the task documentation on how tasks and their dependencies are executed. You need to tell the
mv_tag
task a dependency of thetag
task to ensure the files have finished copying.