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-loader

v1.1.2

Published

Gulp plugin that wraps gulp and loads tasks as seperate files from a gulp folder

Downloads

47

Readme

gulp-loader

Build Status Dependency Status devDependency Status

Gulp plugin that wraps gulp and loads tasks from a specified folder. Task definitions are compatible with gulp-task-loader.

Installation

gulp-loader

Usage

Just write this in your gulpfile.js

/* 
  instead of require('gulp') and then defining tasks on it
  just write the following 
*/
require('gulp-loader')();

Now create a folder next to your gulpfile.js called gulp and have them contain tasks like this:

/*
  no need to require('gulp')
  because gulp is already defined in the scope of the module
*/
module.exports = function () {
	gulp.src('...')
	// your gulp task here
		.pipe(gulp.dest('...'));
}
    
// the following line is optional
module.exports.dependencies = ['dep1', 'dep2'];

(Note: this setup is compatible with gulp-task-loader.) You can also write tasks in coffeescript.

Extra features

gulp-loader wraps the gulp library in a backwards-compatible way and exposes it to the tasks. This means you can define your tasks as if gulp was pre-loaded, but you can also use some shortcuts or extra features.

gulp.util

This exposes the gulp-util library. In other words, you can use gulp.util instead of

var gutil = require('gulp-util');
gutil.log(); // or whatever gulp-util function you would use

gulp.debug

Contains a boolean indicating if the build should assume a develop/debug environment. The default is to assume debugging is needed unless --target=production was provided on the command line. You can use this to adjust build behaviour based on whether debugging is required.

# Usage on the terminal looks like the following
gulp --target=production $task

gulp.name

Contains a string that represents the name of the package. This consists of package.name + '@' + package.version + '.js', wherein package is loaded from package.json. The character '@' can be replaced by another by setting the option gulp.name.infix. Similarly, the extension can be set differently by setting the option gulp.name.extension.

gulp.dirs

A hash containing source, test, build and dist values. These are set from values in the "gulp" entry in package.json using the same names and default to 'src', 'test', 'build' and 'dist' respectively. Each of these folders is resolved relative to the parent of gulpfile.js.

gulp.main

Returns the full pathname of package.main or gulp.dirs.source + '/main.js' if none is set in package.json.

gulp.src()

You can use the gulp.src() function without globPattern parameters. This defaults to streaming every file in the gulp.dirs.source folder. You can also still use the function as you would the normal gulp.src(globPattern) function.

gulp.dest()

You can use the gulp.dest() function without path parameter. This defaults to streaming every file to the gulp.dirs.build folder. You can also still use the function as you would the normal gulp.dest(path) function.

gulp.deploy()

The gulp.deploy() function works similarly to gulp.dest(). This streams every file to the gulp.dirs.test or gulp.dirs.dist folder, depending on the value of gulp.debug.

gulp.task('clean')

By default, the task 'clean' is defined. This clears every file from the gulp.dirs.build folder. This tasks also comes in the variants clean:test and clean:dist to clear the directories gulp.dirs.test or gulp.dirs.dist respectively.

gulp.task('deploy')

By default, the task 'deploy' is defined. This moves every file from the gulp.dirs.build folder into either gulp.dirs.test or gulp.dirs.dist, depending on the value of gulp.debug.

Other features

As this tool is currently in a alpha stage, I am also very open to feature requests at this stage. If you want to request a feature, I would prefer it if you did so by creating a test for it and created a pull request for it. If you do this, use 'FR ' + description of your feature as the title of the pull request.

If you REALLY want a certain feature to get incorporated quickly, you can ofcourse implement it yourself ;) However, I will NOT accept features that aren't accompagnied by their own tests.

License

MIT