How do I group tasks?How to combine gulp-watch and gulp-inject?How to pass a parameter to gulp-watch invoked taskGulp SASS, autoprefixer, minify and sourcemaps generate huge fileStart hexo to generate a watch in a gulpfile.js?gulp - chaining several gulp.src-gulp.dest expressions in one task?Gulp-sass won't compile scss files to css instead copy all files from scss folder to css folderPlumber, notify and a custom error fucntion give me an Error in plugin 'plumber': Message: Can't pipe to undefinedGulp watch with browserSyncHave to run gulp more than once to get Style changesGulp v.4 CSS Inject Using BrowserSync not Working

Was the 1959 Tibetan Uprising really an uprising?

Can commodity 3d printer extrusion hardware and filament be used for injection molding?

How can I grammatically understand "Wir über uns"?

Why was it possible to cause an Apple //e to shut down with SHIFT and paddle button 2?

Where do the UpdateInstallationWizard.aspx logs get saved in Azure PaaS?

Did thousands of women die every year due to illegal abortions before Roe v. Wade?

Working in the USA for living expenses only; allowed on VWP?

Comma Code - Ch. 4 Automate the Boring Stuff

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Why is Colorado so different politically from nearby states?

Chopin: marche funèbre bar 15 impossible place

Did Darth Vader wear the same suit for 20+ years?

PhD student with mental health issues and bad performance

Asking bank to reduce APR instead of increasing credit limit

Please help me identify this plane

Incremental Ranges!

What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?

Can The Malloreon be read without first reading The Belgariad?

Humans meet a distant alien species. How do they standardize? - Units of Measure

What is the correct expression of 10/20, 20/30, 30/40 etc?

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

Why were the Night's Watch required to be celibate?

Is there a rule that prohibits us from using 2 possessives in a row?

Is it OK to bring delicacies from hometown as tokens of gratitude for an out-of-town interview?



How do I group tasks?


How to combine gulp-watch and gulp-inject?How to pass a parameter to gulp-watch invoked taskGulp SASS, autoprefixer, minify and sourcemaps generate huge fileStart hexo to generate a watch in a gulpfile.js?gulp - chaining several gulp.src-gulp.dest expressions in one task?Gulp-sass won't compile scss files to css instead copy all files from scss folder to css folderPlumber, notify and a custom error fucntion give me an Error in plugin 'plumber': Message: Can't pipe to undefinedGulp watch with browserSyncHave to run gulp more than once to get Style changesGulp v.4 CSS Inject Using BrowserSync not Working






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm experimenting with gulp 4 and I have a couple of tasks(buildIndex, buildContent, buildStyling and buildScripts) that insert files in the build folder.



I'd like to group those tasks into one task, so I can execute the group at the top-level.



This is how I got it to work for now. It might not work in the future as this comment states that gulp 4 intents to execute all tasks at top-level.



const src, dest, parallel, series, watch = require('gulp');
const browserSync = require('browser-sync').create();
const clean = require('gulp-clean');
const uglify = require('gulp-uglify');
const sass = require('gulp-sass');
var rename = require('gulp-rename');

exports.default = series(
rebuild,
parallel(
host,
watchSource));

function rebuild(cb)
series(
deleteBuild,
build)();
cb();


function host(cb)
browserSync.init(
server:
baseDir: 'build'

);
watch('build/**').on('change', browserSync.reload);
cb();


function watchSource()
watch('src/**', rebuild);


function deleteBuild()
return src('build', allowEmpty: true, read: false )
.pipe(clean());


function build(cb)
parallel(
buildIndex,
buildContent,
buildStyling,
buildScripts)();
cb();


function buildIndex()
return src('src/index.html')
.pipe(dest('build'))
.pipe(browserSync.stream());


function buildContent()
return src('src/content/**/*.html')
.pipe(dest('build/content'))
.pipe(browserSync.stream());


function buildStyling()
return src('src/styling/**/*.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(dest('build/styling'))
.pipe(browserSync.stream());


function buildScripts()
return src('src/scripts/**/*.js')
.pipe(uglify())
.pipe(rename( extname: '.min.js' ))
.pipe(dest('build/scripts', sourcemaps: true ))
.pipe(browserSync.stream());



What is the correct way to group tasks?










share|improve this question




























    0















    I'm experimenting with gulp 4 and I have a couple of tasks(buildIndex, buildContent, buildStyling and buildScripts) that insert files in the build folder.



    I'd like to group those tasks into one task, so I can execute the group at the top-level.



    This is how I got it to work for now. It might not work in the future as this comment states that gulp 4 intents to execute all tasks at top-level.



    const src, dest, parallel, series, watch = require('gulp');
    const browserSync = require('browser-sync').create();
    const clean = require('gulp-clean');
    const uglify = require('gulp-uglify');
    const sass = require('gulp-sass');
    var rename = require('gulp-rename');

    exports.default = series(
    rebuild,
    parallel(
    host,
    watchSource));

    function rebuild(cb)
    series(
    deleteBuild,
    build)();
    cb();


    function host(cb)
    browserSync.init(
    server:
    baseDir: 'build'

    );
    watch('build/**').on('change', browserSync.reload);
    cb();


    function watchSource()
    watch('src/**', rebuild);


    function deleteBuild()
    return src('build', allowEmpty: true, read: false )
    .pipe(clean());


    function build(cb)
    parallel(
    buildIndex,
    buildContent,
    buildStyling,
    buildScripts)();
    cb();


    function buildIndex()
    return src('src/index.html')
    .pipe(dest('build'))
    .pipe(browserSync.stream());


    function buildContent()
    return src('src/content/**/*.html')
    .pipe(dest('build/content'))
    .pipe(browserSync.stream());


    function buildStyling()
    return src('src/styling/**/*.scss')
    .pipe(sass.sync().on('error', sass.logError))
    .pipe(dest('build/styling'))
    .pipe(browserSync.stream());


    function buildScripts()
    return src('src/scripts/**/*.js')
    .pipe(uglify())
    .pipe(rename( extname: '.min.js' ))
    .pipe(dest('build/scripts', sourcemaps: true ))
    .pipe(browserSync.stream());



    What is the correct way to group tasks?










    share|improve this question
























      0












      0








      0








      I'm experimenting with gulp 4 and I have a couple of tasks(buildIndex, buildContent, buildStyling and buildScripts) that insert files in the build folder.



      I'd like to group those tasks into one task, so I can execute the group at the top-level.



      This is how I got it to work for now. It might not work in the future as this comment states that gulp 4 intents to execute all tasks at top-level.



      const src, dest, parallel, series, watch = require('gulp');
      const browserSync = require('browser-sync').create();
      const clean = require('gulp-clean');
      const uglify = require('gulp-uglify');
      const sass = require('gulp-sass');
      var rename = require('gulp-rename');

      exports.default = series(
      rebuild,
      parallel(
      host,
      watchSource));

      function rebuild(cb)
      series(
      deleteBuild,
      build)();
      cb();


      function host(cb)
      browserSync.init(
      server:
      baseDir: 'build'

      );
      watch('build/**').on('change', browserSync.reload);
      cb();


      function watchSource()
      watch('src/**', rebuild);


      function deleteBuild()
      return src('build', allowEmpty: true, read: false )
      .pipe(clean());


      function build(cb)
      parallel(
      buildIndex,
      buildContent,
      buildStyling,
      buildScripts)();
      cb();


      function buildIndex()
      return src('src/index.html')
      .pipe(dest('build'))
      .pipe(browserSync.stream());


      function buildContent()
      return src('src/content/**/*.html')
      .pipe(dest('build/content'))
      .pipe(browserSync.stream());


      function buildStyling()
      return src('src/styling/**/*.scss')
      .pipe(sass.sync().on('error', sass.logError))
      .pipe(dest('build/styling'))
      .pipe(browserSync.stream());


      function buildScripts()
      return src('src/scripts/**/*.js')
      .pipe(uglify())
      .pipe(rename( extname: '.min.js' ))
      .pipe(dest('build/scripts', sourcemaps: true ))
      .pipe(browserSync.stream());



      What is the correct way to group tasks?










      share|improve this question














      I'm experimenting with gulp 4 and I have a couple of tasks(buildIndex, buildContent, buildStyling and buildScripts) that insert files in the build folder.



      I'd like to group those tasks into one task, so I can execute the group at the top-level.



      This is how I got it to work for now. It might not work in the future as this comment states that gulp 4 intents to execute all tasks at top-level.



      const src, dest, parallel, series, watch = require('gulp');
      const browserSync = require('browser-sync').create();
      const clean = require('gulp-clean');
      const uglify = require('gulp-uglify');
      const sass = require('gulp-sass');
      var rename = require('gulp-rename');

      exports.default = series(
      rebuild,
      parallel(
      host,
      watchSource));

      function rebuild(cb)
      series(
      deleteBuild,
      build)();
      cb();


      function host(cb)
      browserSync.init(
      server:
      baseDir: 'build'

      );
      watch('build/**').on('change', browserSync.reload);
      cb();


      function watchSource()
      watch('src/**', rebuild);


      function deleteBuild()
      return src('build', allowEmpty: true, read: false )
      .pipe(clean());


      function build(cb)
      parallel(
      buildIndex,
      buildContent,
      buildStyling,
      buildScripts)();
      cb();


      function buildIndex()
      return src('src/index.html')
      .pipe(dest('build'))
      .pipe(browserSync.stream());


      function buildContent()
      return src('src/content/**/*.html')
      .pipe(dest('build/content'))
      .pipe(browserSync.stream());


      function buildStyling()
      return src('src/styling/**/*.scss')
      .pipe(sass.sync().on('error', sass.logError))
      .pipe(dest('build/styling'))
      .pipe(browserSync.stream());


      function buildScripts()
      return src('src/scripts/**/*.js')
      .pipe(uglify())
      .pipe(rename( extname: '.min.js' ))
      .pipe(dest('build/scripts', sourcemaps: true ))
      .pipe(browserSync.stream());



      What is the correct way to group tasks?







      gulp gulp-4






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 12:19









      Janneman96Janneman96

      1191316




      1191316






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Edit:



          Your already decalring the default task in export.default. If you want to add another task that runs the tasks you mentioned, you can do it like this:



          Run the tasks in parallel:



          exports.mynewtask = parallel(buildIndex, buildContent, buildStyling, buildScripts);


          Run the tasks one after another:



          exports.mynewtask = series(buildIndex, buildContent, buildStyling, buildScripts);


          This seems to be the correct way for grouping tasks as you can see in this Gulp.js documentation for parallel().



          .



          The same with old Gulp syntax would be like this:



          const gulp = require("gulp");
          ...
          gulp.task('default', gulp.parallel('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));
          // or
          gulp.task('default', gulp.series('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));





          share|improve this answer

























          • I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

            – Janneman96
            Mar 26 at 14:16











          • Sure. I edited the answer to comply with the new syntax.

            – lofihelsinki
            Mar 26 at 14:27











          • @janneman96 Does the new syntax answer your question?

            – lofihelsinki
            Mar 27 at 12:44












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323730%2fhow-do-i-group-tasks%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Edit:



          Your already decalring the default task in export.default. If you want to add another task that runs the tasks you mentioned, you can do it like this:



          Run the tasks in parallel:



          exports.mynewtask = parallel(buildIndex, buildContent, buildStyling, buildScripts);


          Run the tasks one after another:



          exports.mynewtask = series(buildIndex, buildContent, buildStyling, buildScripts);


          This seems to be the correct way for grouping tasks as you can see in this Gulp.js documentation for parallel().



          .



          The same with old Gulp syntax would be like this:



          const gulp = require("gulp");
          ...
          gulp.task('default', gulp.parallel('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));
          // or
          gulp.task('default', gulp.series('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));





          share|improve this answer

























          • I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

            – Janneman96
            Mar 26 at 14:16











          • Sure. I edited the answer to comply with the new syntax.

            – lofihelsinki
            Mar 26 at 14:27











          • @janneman96 Does the new syntax answer your question?

            – lofihelsinki
            Mar 27 at 12:44
















          0














          Edit:



          Your already decalring the default task in export.default. If you want to add another task that runs the tasks you mentioned, you can do it like this:



          Run the tasks in parallel:



          exports.mynewtask = parallel(buildIndex, buildContent, buildStyling, buildScripts);


          Run the tasks one after another:



          exports.mynewtask = series(buildIndex, buildContent, buildStyling, buildScripts);


          This seems to be the correct way for grouping tasks as you can see in this Gulp.js documentation for parallel().



          .



          The same with old Gulp syntax would be like this:



          const gulp = require("gulp");
          ...
          gulp.task('default', gulp.parallel('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));
          // or
          gulp.task('default', gulp.series('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));





          share|improve this answer

























          • I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

            – Janneman96
            Mar 26 at 14:16











          • Sure. I edited the answer to comply with the new syntax.

            – lofihelsinki
            Mar 26 at 14:27











          • @janneman96 Does the new syntax answer your question?

            – lofihelsinki
            Mar 27 at 12:44














          0












          0








          0







          Edit:



          Your already decalring the default task in export.default. If you want to add another task that runs the tasks you mentioned, you can do it like this:



          Run the tasks in parallel:



          exports.mynewtask = parallel(buildIndex, buildContent, buildStyling, buildScripts);


          Run the tasks one after another:



          exports.mynewtask = series(buildIndex, buildContent, buildStyling, buildScripts);


          This seems to be the correct way for grouping tasks as you can see in this Gulp.js documentation for parallel().



          .



          The same with old Gulp syntax would be like this:



          const gulp = require("gulp");
          ...
          gulp.task('default', gulp.parallel('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));
          // or
          gulp.task('default', gulp.series('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));





          share|improve this answer















          Edit:



          Your already decalring the default task in export.default. If you want to add another task that runs the tasks you mentioned, you can do it like this:



          Run the tasks in parallel:



          exports.mynewtask = parallel(buildIndex, buildContent, buildStyling, buildScripts);


          Run the tasks one after another:



          exports.mynewtask = series(buildIndex, buildContent, buildStyling, buildScripts);


          This seems to be the correct way for grouping tasks as you can see in this Gulp.js documentation for parallel().



          .



          The same with old Gulp syntax would be like this:



          const gulp = require("gulp");
          ...
          gulp.task('default', gulp.parallel('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));
          // or
          gulp.task('default', gulp.series('buildIndex', 'buildContent', 'buildStyling', 'buildScripts'));






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 27 at 12:49

























          answered Mar 26 at 7:43









          lofihelsinkilofihelsinki

          1,29111020




          1,29111020












          • I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

            – Janneman96
            Mar 26 at 14:16











          • Sure. I edited the answer to comply with the new syntax.

            – lofihelsinki
            Mar 26 at 14:27











          • @janneman96 Does the new syntax answer your question?

            – lofihelsinki
            Mar 27 at 12:44


















          • I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

            – Janneman96
            Mar 26 at 14:16











          • Sure. I edited the answer to comply with the new syntax.

            – lofihelsinki
            Mar 26 at 14:27











          • @janneman96 Does the new syntax answer your question?

            – lofihelsinki
            Mar 27 at 12:44

















          I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

          – Janneman96
          Mar 26 at 14:16





          I'm doing that in the first line: const src, dest, parallel, series, watch = require('gulp');. I'm importing all the functions I need. The syntax I'm using is new in gulp 4. Here's information: gulpjs.com

          – Janneman96
          Mar 26 at 14:16













          Sure. I edited the answer to comply with the new syntax.

          – lofihelsinki
          Mar 26 at 14:27





          Sure. I edited the answer to comply with the new syntax.

          – lofihelsinki
          Mar 26 at 14:27













          @janneman96 Does the new syntax answer your question?

          – lofihelsinki
          Mar 27 at 12:44






          @janneman96 Does the new syntax answer your question?

          – lofihelsinki
          Mar 27 at 12:44




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323730%2fhow-do-i-group-tasks%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

          Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?