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-foxy-less

v0.1.1

Published

Dependency driven stream extender for gulp-less tasks.

Downloads

10

Readme

gulp-foxy-less

Keep track of less dependencies

With gulp-foxy-less you can improve your gulp-less tasks to not only react on single file changes, but also run dependent less files through your less.

The plugin inspects the file event stream and analyzes the content of input .less files for @import statements. It keeps track of found dependencies and will automatically push new vinyl instances into the stream for any .less file that depends on the one just changed.

Install

$ npm install --save-dev gulp-foxy-less

Usage

Without pre-analysis of the dependencies -- e.g. if a standalone less task exists besides a watch-less task.

var gulp = require('gulp');
var watch = require('gulp-watch');
var less = require('gulp-less');
var foxyLess = require('gulp-foxy-less');

var foxy = foxyLess();
var lessFiles = ['app/**/*.less'];

gulp.task('less', function() {
  gulp.src(lessFiles)
    .pipe(foxy.transform())
    .pipe(less())
    .pipe(gulp.dest('app/'));
});

gulp.task('watch-less', function() {
  watch(lessFiles, function(files) {
    files
      .pipe(foxy())
      .pipe(less())
      .pipe(gulp.dest('app/'));
  });
});

gulp.task('default', ['less', 'watch-less']);

With pre-analyzing less dependencies -- e.g. when creating an independent standalone watch-less task.

var gulp = require('gulp');
var watch = require('gulp-watch');
var less = require('gulp-less');
var foxyLess = require('gulp-foxy-less');

gulp.task('watch-less', function() {
  var lessFiles = ['app/**/*.less'];
  var foxy = foxyLess({verbose: true}).preAnalyze(lessFiles);

  watch(lessFiles, function(files) {
    files
      .pipe(foxy())
      .pipe(less())
      .pipe(gulp.dest('app/'));
  });
});

API

foxyLess(opts)

Returns a factory function that generates a new through2 object stream to be passed into a .pipe().

opts

opts.verbose

Type: Boolean
Default: false

Prints update actions of less dependency and additional generated vinyl file events (pushes).

Functions

.preAnalyze(files, done)

Usually helpful when only using a plain watch task without transpiling all .less files in a first place (feeding the foxy-less already).

Otherwise, every time the (through2) transform stream created by FoxyLess.transform() receives a file event it will parse the content if the file is not already in the index.

files

Type: String or Array

Single string or array of glob strings that will be evaluated with glob-all.

done

Type: Function
Default: null

Callback that will be invoked when all glob matched files were analyzed.

~~.transform()~~

obsolete

Generates a new through2 object stream to be passed into a .pipe().

You might invoke the returned function of the foxyLess factory directy:

var foxyLess = require('gulp-foxy-less');
var foxy = foxyLess().preAnalyze(lessFiles);
foxy.transform(); // returns the through2 object stream

Is now similar to:

var foxyLess = require('gulp-foxy-less');
var foxy = foxyLess().preAnalyze(lessFiles);
foxy(); // <<< see?

Changelog

0.1.1

  • fixes module.export to return a factory function (instead of constructor)
  • marks .transport() function obsolete as new factory will return a function

Todo

  • Update dependencies always/if changed (not only on when missing in internal index)

License

MIT License