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

v1.0.0-rc

Published

gulp config tools

Downloads

14

Readme

#gulp config

npm install --save-dev gulp-config2

##Easier to use No longer have to write code, configuration only

import gconf from 'gulp-config2'
gconf({
  'gulp-sass': {
    src: 'src/**/*.*',
    dest: 'public',
    options: {}
  }
})

##Reuse your tasks If you would like to write some task yourself, it can be exactly the same to the NPM modules tasks/myTask.js

import through from 'through2'
export default function(options) {
  return through.obj(function (chunk, enc, cb) {
    cb(null, dealWithTheChunk(chunk, options))
  })
})

gulpfile.js

gconf({
  'myTask': {
    task: './tasks/myTask',
    src: 'src/**/*.*',
    dest: 'public',
    options: {}
  }
})

Try to use src/dest/options through functions

##Usage: ###Add a built-in copy task, copy clean are ready to use.

gconf({
  copy: {
    src: 'src/**/*.*',
    dest: 'public'
  }
})

It's exactly the same to this gulp task:

gulp.task('copy', function () {
  return gulp.src('src/**/*.*')
    .pipe(gulp.dest('public'))
})

###Add a task from a NPM module gulp-sass

gconf.load('gulp-mocha')
gconf({
  'gulp-mocha': {
    src: 'src/**/*.spec.js',
    // some options
  }
})

It's exactly the same to this gulp task:

gulp.task('gulp-mocha', function () {
  return gulp.src('src/**/*.spec.js')
    .pipe(require('gulp-mocha')(/*some options*/))
})

###Add a renamed tasks

gconf({
  dest: 'public',
  'custom-copy': {
    task: './tasks/copy'
    src: ['src/**/*.js'],
    dest: 'dist',//overwrote the global dest
  },
  'sass': {
    task: 'gulp-sass',
    src: ['src/sass/index.scss']
  }
})

###Config a task with multiple entries

gconf.load('copy')
gconf({
  'copy': {
    files: [{
        src: ['src1/**/*.js'],
        dest: 'dist1',
      },{
        src: ['src2/**/*.js'],
        dest: 'dist2',
    }]
  }
})

###Add a queue task

gconf.queue({
  mirror: [
    'clean',
    'copy'
  ]
})

gconf({
  mirror: {
    'clean': {
      src: [
        'public/images',
        'public/webfont',
      ]
    },
    'copy': [{
      src: 'src/assets/images',
      dest: 'public/images'
    },{
      src: 'node_modules/webfont/**/*.*',
      dest: 'public/webfont'
    }]
  }
})

###Add a pipeline task

gconf.pipelines({
  css: ['gulp-sass', 'gulp-prefix']
})

gconf({
  dest: 'public',
  css: {
    src: 'src/*.css',
    dest: 'dist', //otherwise use the global dest
    'gulp-sass': {
      // options
    },
    'gulp-prefix': {
      // options
    }
  }
})

It's exactly the same to this gulp task:

gulp.task('css', function () {
  return gulp.src('src/*.css')
    .pipe(require('gulp-sass')(/*sometions*/))
    .pipe(require('gulp-prefix')(/*sometions*/))
    .pipe(gulp.dest('public'))
})

###Add multiple tasks

gconf
.load('copy', 'browserify', 'gulp-sass', 'gulp-autoprefixer', 'gulp-jshint')

gconf({
  src: ['src/**/*.js'], //for simple projects
  dest: 'dist', //for simple projects
  'gulp-jshint': {
    node: true
  }
})

###For complex and bigger projects Create sub-project rules for special folders like: src.project.myModule

// TODO
gconf.project('project', {
  default: 'myModule',
  //src: src.project.myModule,
  dest: 'public',
  'project-copy': {
    src: ''
  }
})