Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slush

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slush

The streaming scaffolding system - Gulp as a replacement for Yeoman

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
increased by75%
Maintainers
1
Weekly downloads
 
Created
Source

slush NPM version Build Status Dependency Status

The streaming scaffolding system - Gulp as a replacement for Yeoman

Use Gulp instead of Yeoman

Slush is a tool to be able to use Gulp for project scaffolding.

Slush does not contain anything "out of the box", except the ability to locate installed slush generators and to run them with liftoff.

To be able to provide functionality like Yeoman, see: Yeoman like behavior below.

Install

Install slush globally with:

npm install -g slush

Usage

slush <generator>[ <tasks>]

Note if <tasks> is not provided it will default to the default task in the generator's slushfile.

List available generators

slush

List available tasks in generator

slush <generator> --tasks

Creating a generator

A Slush generator is an npm package following the naming convention slush-* and containing a slushfile.js.

Add slushgenerator as a keyword in your package.json.

As when building gulp plugins all slush generators need to have gulp installed as a local dependency.

All slush-* packages should be installed globally (for now) to be found by the slush executable.

Note remember to add gulp plugins (and gulp itself) as ordinary dependencies, instead of devDependencies, when building a slush generator.

Documentation

Things to remember

  • Install slush globally
  • Install slush generators globally
  • When creating slush generators:
    • name them slush-<name>
    • add slushgenerator as package keyword
    • create a slushfile.js
    • Install gulp and used gulp plugins for your generator as ordinary dependencies

Slush uses gulp

Slush is just the global excutable to trigger slush generators, under the hood it's still gulp that is run using each slushfile as config file.

Needing help writing slush generators? Check out Gulp's documentation!

The slushfile

A slushfile is basically a gulpfile, but meant to be used to scaffold project structures.

Why not name it "gulpfile" then?

Because a Slush generator may want to use gulp locally for linting, testing and other purposes, in which case it will need to have a gulpfile.

Sample slushfile

Given a slush generator project structure with a web app project template inside ./templates/app/, a slushfile could be designed like this:

var gulp = require('gulp'),
    install = require('gulp-install'),
    conflict = require('gulp-conflict'),
    template = require('gulp-template'),
    inquirer = require('inquirer');

gulp.task('default', function (done) {
  inquirer.prompt([
    {type: 'confirm', name: 'app', message: 'Create a new app?'},
    {type: 'confirm', name: 'another', message: 'Something else?'}
  ],
  function (answers) {
    if (!answers.app) {
      return done();
    }
    gulp.src(__dirname + '/templates/app/**')  // Note use of __dirname to be relative to generator
      .pipe(template(answers))                 // Lodash template support
      .pipe(conflict('./'))                    // Confirms overwrites on file conflicts
      .pipe(gulp.dest('./'))                   // Without __dirname here = relative to cwd
      .pipe(install())                         // Run `bower install` and/or `npm install` if necessary
      .on('end', function () {
        done();                                // Finished!
      });
  });
});

Yeoman like behavior

Use these packages/plugins:

  • inquirer - To prompt the user for input
  • gulp-install - To install npm and bower packages after scaffolding
  • gulp-conflict - To prompt before overwriting files on regeneration

Want to contribute?

Anyone can help make this project better!

FAQs

Package last updated on 24 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc