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;
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
add a comment |
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
add a comment |
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
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
gulp gulp-4
asked Mar 24 at 12:19
Janneman96Janneman96
1191316
1191316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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'));
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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'));
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
add a comment |
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'));
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
add a comment |
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'));
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'));
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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