Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Eric
    @sliceofbytes
    @nfquerido_gitlab can you just use since and lastrun
    Nathan Querido
    @nfquerido_gitlab
    @sliceofbytes I'm not aware of either. Do you have a suggestion?
    Nathan Querido
    @nfquerido_gitlab
    Thanks!!
    Eric
    @sliceofbytes
    no worries, there are also some plugins that do similar things https://github.com/sindresorhus/gulp-changed
    Nathan Querido
    @nfquerido_gitlab
    I couldn't get that plugin to work reliably
    with since and lastRun Im getting this error TypeError: Cannot read property 'lastRun' of undefined
    Eric
    @sliceofbytes
    what does your task look like?
    Nathan Querido
    @nfquerido_gitlab
    const buildCSS = (done) => {
    
        // Make sure this feature is activated before running
        if (!settings.styles) return done();
    
        // PostCSS plugins
        const processors = [
            postcssEasyImport(),
            autoprefixer(),
            tailwindcss(),
            cssnano(),
            postcssDiscardComments({ removeAll: true }),
        ];
    
        // Run task on all Less files
        return src(paths.source + paths.styles.source, {since: gulp.lastRun(styles)})
            .pipe(gulpif(production, cleancss({level: {1: { specialComments: false }}})))
            .pipe(postcss(processors))
            .pipe(rename({extname: '.css'}))
            .pipe(gulpif(development, notify("CSS compiled, minified and gzip compressed: <%= file.relative %>")))
            .pipe(dest(paths.build + paths.styles.build));
    };
    Eric
    @sliceofbytes
    Do you have gulp imported?
    or required
    import gulp from 'gulp';
    Nathan Querido
    @nfquerido_gitlab
    I think this const {gulp, src, dest, watch, series, parallel} = require('gulp');
    Eric
    @sliceofbytes
    I would just try requiring gulp on it's own line and see if that fixes the issue
    I've been using the new syntax for quite a while now so not positive
    Nathan Querido
    @nfquerido_gitlab
    if that doest work, do you have another suggestion?
    Eric
    @sliceofbytes
    well the exception is pretty clear, gulp is showing up as undefined so gotta figure out why gulp is undefined
    obviously src etc.. are defined since your tasks were running
    I gues you could just try importing lastRun like you did for src, dest etc..
    Nathan Querido
    @nfquerido_gitlab
    Eric
    @sliceofbytes
    Ya, I would just stick with the older syntax, no real need to refactor
    const {gulp, src, dest, watch, series, parallel, lastRun} = require('gulp')
    try that and remove the gulp before lastRun
    Nathan Querido
    @nfquerido_gitlab
    Thanks yeah, trying that
    return src(paths.source + paths.styles.source, {since: lastRun(<is it the task name?>)})
    what do I reference in lastRun?
    ah
    Eric
    @sliceofbytes
    Ya, you would wrap your return in a function, then reference the function in your watch
    Nathan Querido
    @nfquerido_gitlab
    Thanks a million, experimenting
    Damien Retzinger
    @damienwebdev
    @sliceofbytes I have two functions:
    const func1 = () => {
      return getRootPackage().then((rootPackage) => src(RELEASE_CONFIG.DIST + '/*/package.json')
        .pipe(
          through2.obj(function(file, _, cb) {
            ...
            cb(null, file);
          })
        )
        .pipe(dest(RELEASE_CONFIG.DIST))
      )
    }
    
    const func2 = () => {
      return getRootPackage().then((rootPackage) => src(RELEASE_CONFIG.DIST + '/*/package.json')
        .pipe(
          through2.obj(function(file, _, cb) {
            ...
            cb(null, file);
          })
        )
        .pipe(dest(RELEASE_CONFIG.DIST))
      )
    }
    
    export const s = series(
      func1, 
      func2
    );
    Since these modify the same file in place, I have a race condition that appears to occur where func2 is being called while func1 is still writing into its file.
    My understanding was that in gulp4, returning the promise/stream would cause the task to only proceed to the next task when the prior one resolved.
    But, it appears that "writing" is not complete because this pair of tasks intermittently succeeds when run in series. Any ideas?
    Damien Retzinger
    @damienwebdev
    I've also tried the async/await versions of the tasks, but without success.
    Eric
    @sliceofbytes
    @damienwebdev I'm not positve but it looks like you might be mixing the promise return style with the error first callback style
    Andy Bayer
    @anderoonies
    hey all, i'm having a weird issue where a task's dependency is being run, and is completing, but the task which depends on it is never running. i've confirmed the dependency is returning the stream
    Andy Bayer
    @anderoonies
    issue with merge stream
    Andy Bayer
    @anderoonies
    has anyone used tasks that have mergeStreams as dependenceis? should be trivial but is not working
    Andy Bayer
    @anderoonies
    a task with dependencies works when it's run by itself (gulp taskname), but when running a task which depends on it it doesn't even start
    John Manko
    @johnmanko
    Is there a way to avoid Starting '<anonymous>' when using shell.task, like exports.ngBuild = series(shell.task(...))
    I'd like the task to be named, instead of "anonymous"
    cаввидис
    @panoply
    @johnmanko name the function or leverage the displayName property.
    Marc Guilera
    @marcguilera
    hey
    i would like to use gulp with objects (ie config) and not files. is it possible to create an object stream?
    cаввидис
    @panoply
    @marcguilera how do you mean? You want Gulp to build upon and extend upon an existing object?
    Behrang
    @behrangsa

    Any ideas why this doesn't print console output?

    'use strict';
    
    import { exec } from 'child_process';
    import { task } from 'gulp';
    
    task('build', function(cb) {
      exec('bundle exec jekyll serve --incremental', function(err, stdout, stderr) {
          console.log(stdout);
          console.log(stderr);
          cb(err);
      });
    });

    CLI version: 2.2.0
    Local version: 4.0.2

    Pablo Rubiano
    @pcrubianoa
    hello, good evening!

    How is it possible to overwrite a file?

    .src ('js / main.js')
    .pipe (process ...)
    .pipe (gulp.dest ('js / main.js'));

    *gulp 3
    Jentan Bernardus
    @jentanbernardus
    @pcrubianoa Maybe you should look into gulp-replace