1.0.3 • Published 6 years ago

gulp-slurp v1.0.3

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
6 years ago

gulp-slurp

This package is designed to work with gulp! It is a set of Promise(bluebird) tools to make development a bit easier.

$ npm install gulp-slurp

javascript (browserify, gulp-sourcemaps, gulp-uglify, gulp-babel)

const slurp = require('gulp-slurp');
const gulp = require('gulp');

// Want to browserify a file real quick? Does your file have a custom module that's
// not in the node_modules folder?

gulp.task('build', slurp.js('src/index.js', {compress: true, paths: ['modules']}).then(thru => thru.dest('build')))

// Easy!
gulp.task('default', gulp.series('build'))

Since this relies on gulp modules, you don't really even need to require gulp! Use it straight up!

pug/jade (gulp-pug)

const slurp = require('gulp-slurp');

slurp.pug('src/index.pug', {}).then(thru => thru.dest('build'))

stylus (gulp-stylus)

const slurp = require('gulp-slurp');

slurp.stylus('src/style.styl', {}).then(thru => thru.dest('build'))

manifest (chrome, firefox, etc...)

const slurp = require('gulp-slurp');

let opts = {
  name: "Platypus",
  desc: "A webextension!",
  vers: "1.0",
  permissions: ["tabs", "activeTab", "webRequest", "cookies", "<all_urls>"],
  listen: ['http://*//*'],
  background: ['background.js'],
  scripts: ['index.js'],
  public: ["web/*"]
}

slurp.manifest('manifest.json', opts).then(thru => thru.dest('build'))

delete files (del)

const slurp = require('gulp-slurp');

slurp.remove('build/**/*').then() => { })

write a file (gulp-file)

const slurp = require('gulp-slurp');

slurp.file('index.js', "console.log('Hello World!');").then(thru => thru.dest('build')))

Coming up, TODO

  • Include custom variable replacement. Webpack is already able to do this but does it "cooler" (I guess...)instead of straight up replacing. I don't want to use process.env either.
  • Add other gulp modules