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

v1.1.2

Published

Allow you to run task with param (NOT from cmd) when gulp's running.

Downloads

8

Readme

gulp-foal

为gulp提供可定制参数的task

Install 安装

npm install gulp-foal --save-dev

Basic Usage 基本用法

Use gulp-foal like this:

'use strict';

var gulp = require('gulp');
var clean = require('gulp-clean');
var foal = require('gulp-foal')();

//use "foal.task(...)" to define a foal-task.
//使用 foal.task(...) 来定义一个 foal 任务
foal.task('clean_some', function(cleanPath) {
  //"return" shall not be missed for running foal-task orderly.
  //为了顺序执行 foal 任务,请别省略 return 语句
  return gulp.src(cleanPath)
    .pipe(clean());
});

gulp.task('default', function(cb) {
  //use "foal.run(...)" to run your foal-task with param.
  //使用 foal.run(...) 来执行带参数的 foal 任务
  foal.run(foal.clean_some('test_path'), cb);
  //put 'cb' to the end of foal-run-task-list when using foal-run in gulp-task for running gulp-task orderly.
  //当在gulp-task中使用foal.run时,请务必将 cb 放在foal.run函数列表的末尾,以保证gulp任务顺序执行
});

foal.run()

It ran just like gulp-sequence which means you can use it like this:

它跑起来和 gulp-sequence 类似,你可以像下面的例子那样使用它:

foal.run(task1('param'), [task2('param'), task3()], task4('param'), cb);

foal.task()

Foal-task is bind to object 'foal' by default. If you don't want it to, use like this:

foal 任务默认被绑定在foal对象下, 如果你不希望这样,如下

var my_foal_tasks = {};
var foal = require('gulp-foal')(my_foal_tasks);

foal.task('test', function(param) {/*...*/});

foal.run(my_foal_tasks.test(param));

Or like this: 或者这样


var foal = require('gulp-foal')();
var my_foal_tasks = {};
foal.bindTo(my_foal_tasks);

foal.task('test', function(param) {/*...*/});

foal.run(my_foal_tasks.test(param));

Task Combination 合并的任务

Combine your foal-task and run them like this:

如下所示,合并执行你的任务:


var foal = require('gulp-foal')(global);

gulp.task('default', ['all_page']);

gulp.task('all_page', () => {
  return gulp.src(`${PATH.DEVELOP}/page/*/`)
    .pipe(through.obj(function(file, enc, cb) {
      this.push(file);
      const pageName = file.relative;
      const pagePath = `${PATH.DEVELOP}/page/${pageName}`;
      foal.run(page(pageName, pagePath), cb);
    }));
});

foal.task('page', (pageName, pagePath) => {
  return foal.run([js(pageName, pagePath), css(pageName, pagePath)]);
});

foal.task('page_jsx', (pagePath) => {
  return gulp.src(`${pagePath}/**/*.jsx`)
    .pipe(react())
    .pipe(gulp.dest(`${pagePath}/.transform`))
});

foal.task('page_js', (pageName, pagePath) => {
  return gulp.src([`${PATH.DEVELOP}/common/.transform/**/*.js`, `${pagePath}/**/*.js`, `${pagePath}/.transform/**/*.js`])
    .pipe(concat(`${pageName}.js`))
    .pipe(gulp.dest(`${pagePath}/.build`))
})

foal.task('js', (pageName, pagePath) => {
  return foal.run(page_jsx(pagePath), page_js(pageName, pagePath));
});

foal.task('css', (pageName, pagePath) => {
  return gulp.src(`${pagePath}/*.scss`)
    .pipe(sass().on('error', sass.logError))
    .pipe(rename(`${pageName}.css`))
    .pipe(gulp.dest(`${pagePath}/.build`));
});

The MIT License (MIT)

Copyright (c) 2016 CJY [email protected]