npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-pattern

v0.2.2

Published

pattern for organising gulp tasks and workflows

Downloads

4

Readme

gulp-pattern

A helper gulp plugin you can use to keep your gulp tasks more organised and structured.

Contents

Directory structure


All the files which will be used by gulp are organised in a gulp/ folder, in the root of the application. gulpfile.js will then be told to look through this folder and look for any tasks and config required for the application.

The directory structure should look like this:

gulp/
    tasks/
    workflows/
    config/

In tasks/ you'd expect to find all the individual gulp tasks. Tasks should be as coherent as possible, with each one attempting to do one thing only. If you want to do more than one thing, then you should think about using a workflow.

The naming convention for tasks is [npm or task name].tsk.js

In workflows/ you'd expect to find specific workflows, which calls a group of the the individual tasks, related to that workflow. A workflow should be thought of as a group of tasks, and should be representative of a particular action run against your application.

Naming convention is [workflow name].wflow.js

In config/, you'll find the config files for the app in general: app.conf.js, and other custom config files for specific tasks, like; jshint, stylus.

Naming convention is app.conf.js

This config file should ideally be very thin, to limit the amount of config you'd need to remember when writing out your tasks and flows.

Using gulp-pattern


To use this plugin, you're going to need the following dev dependencies:

  • gulp-help
  • yargs

Make sure you wrap gulp in gulp-help. See the docs for more information. You also want to require in yargs:

var gulp = require('gulp-help')(require('gulp'));
var args = require('yargs').argv;

This plugin assumes you are following the directory structure recommended. This would look like:

gulp/
    configs/
        app.conf.js
    tasks/
        [task name].tsk.js
    workflows/
        [workflow name].wflow.js

If you want to pass on your app's config to your tasks and workflows, then require it in your gulpfile.

var config = require('./gulp/configs/app.conf.js');

Now you're all set to let gulp-pattern do its job.

require('gulp-pattern').setup(gulp, args, config);

This will now go through your tasks and workflows and add them to git. To view them, hit:

gulp list

What is gulp-pattern?


To understand better what gulp-pattern is, and how to use it, check out the blog post.