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

@ideasonpurpose/gulp-task-copy

v0.1.2

Published

A gulp 4 task for copying static assets

Downloads

15

Readme

npm dependencies Status code style: prettier

Installation

$ yarn add @ideasonpurpose/gulp-task-copy

  or

$ npm install @ideasonpurpose/gulp-task-copy

Usage

This module is a factory function which returns a pre-configured copy task for gulp 4.

Basic

Call the create method directly on the import. In most cases, just trust the defaults and go:

// Call `create` on the require to initialize a new task
const copy = require("@ideasonpurpose/gulp-task-copy").create();

// Export to make the task publicly callable
exports.copy = copy;

Options

const defaults = {
  src: ["**/*", "!webpack.config.js", "!{images,js,sass}/**/*"],
  srcOptions: { cwd: "./src", nodir: true },
  dest: "./dist"
};

The create method accepts one configuration object. This module accepts four properties:

  • src
    A glob string or array of glob-strings. Defaults to ["**/*", "!webpack.config.js", "!{images,js,sass}/**/*" Passed directly to gulp.src

  • srcOptions
    An object containing any options recognized by gulp.src string or array of glob-strings. Defaults to { cwd: "./src", nodir: true }. All options are passed directly to gulp-src except for since.

    • srcOptions.since
      To use incremental builds, set the value of since to true. This will be replaced with gulp.lastRun in the generated function. (The gulp instance will also need to be included, see gulp below)
  • dest
    The output path to be passed to gulp.dest Defaults to dist Passed directly to gulp.dest

  • gulp
    The current gulp instance. Required when srcOptions.since is true or when using the watch helper method.

Incremental Builds

If srcOptions includes since: true, a gulp instance must be passed into the task for the incremental build checks to work correctly. Something like this:

const copy = require("@ideasonpurpose/gulp-task-copy").create({
  src: ["**/*", "!webpack.config.js", "!{images,js,sass}/**/*"],
  srcOptions: { since: true },
  dest: "dist",
  gulp // or `gulp: gulp`, same thing.
});

Incremental builds may prevent newly added files from being processed. If the modification dates of the new files are before the task's last-run timestamp, the new files will not be processed. Either restart the watch or touch the files to be added.

Watch helper

Very frequently, gulp watch globs are identical to the source globs for a given task. To reduce repetition, the generated task includes a helper method which calls gulp.watch with default arguments. This makes writing watch tasks very concise and easy to maintain.

const copy = require("@ideasonpurpose/gulp-task-copy").create({ gulp });

const watch = () => {
  copy.watch(); // calls `gulp.watch(src, {cwd: srcOptions.cwd}, copy)`
};