How to Consume and Run Gulp Tasks in Other Files from a Central Gulpfile

How to Consume and Run Gulp Tasks in Other Files from a Central Gulpfile

Learn how to Consume and Run Gulp Tasks in Other Files from a Central Gulpfile. aA common question asked about gulp is this: How can I run the tasks of other gulpfiles from a central gulpfile, like a hub? There are two gulp libraries which purport to help: gulp-hub and gulp-chug repetitive tasks like running.

aA common question asked about *gulp *is this: How can I run the tasks of other gulpfiles from a central gulpfile, like a hub?

A typical scenario might be a project containing two SASS libraries, each importing from a shared set of scss files, but also outputting a slightly different flavoured style sheet - one for the public facing website, another for the admin backend (for instance).

There are two gulp libraries which purport to help: __gulp-hub __and_ gulp-chug_. Neither maintained for years, and the latter has been blacklisted by _**_gulp**: no reason for this to exist, use the require-all module or node's require.

Let's not use those: Vanilla is best; especially if it's simple; and - as it turns out - using require makes it dead simple. I will show you how.

A Multi-Gulpfile Solution

This article will scaffold a solution for the example given above. To play along, create a working folder somewhere and run the following (in one go):

mkdir great-gulping-website
cd great-gulping-website
npm init -y
npm i gulp browser-sync --save-dev
touch gulpfile.js index.html package.json stylesheet.scss

mkdir admin-site
cd admin-site
npm init -y
npm i gulp gulp-sass --save-dev
touch gulpfile.js index.html package.json stylesheet.scss

cd ..
mkdir public-site
cd public-site
npm init -y
npm i gulp gulp-sass --save-dev
touch gulpfile.js index.html package.json stylesheet.scss

javascript gulpjs devops

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How to Extend your DevOps Strategy For Success in the Cloud?

DevOps and Cloud computing are joined at the hip, now that fact is well appreciated by the organizations that engaged in SaaS cloud and developed applications in the Cloud. During the COVID crisis period, most of the organizations have started using cloud computing services and implementing a cloud-first strategy to establish their remote operations. Similarly, the extended DevOps strategy will make the development process more agile with automated test cases.

What Is DevOps and Is Enterprise DevOps Any Good?

What is DevOps? How are organizations transitioning to DevOps? Is it possible for organizations to shift to enterprise DevOps? Read more to find out!

DevOps Basics: What You Should Know

What is DevOps? What are the goals it helps achieves? What are its benefits? This article has answers!

Why You Should Be Adopting a DevOps Culture in 2020 - DZone DevOps

The year 2020 has arrived, and its arrival brings a lot of innovations and transformations in the Information and Technology (IT) sector to DevOps technologies.

Measuring DevOps Metrics: A How-To Guide

DevOps is supposed to help streamline the process of taking code changes and getting them to production for users to enjoy. But what exactly does it mean for the process to be "streamlined"? One way to answer this is to start measuring metrics.