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-rev-collector-gqy

v1.0.0

Published

Static asset revision data collector from manifests, generated from different streams, and replace their links in html template.

Downloads

2

Readme

Build Status Dependencies devDependencies NPM version

gulp-rev-collector

NPM

Static asset revision data collector from manifests, generated from different streams, and replace their links in html template.

Install

$ npm install --save gulp-rev-collector-gqy

Usage

We can use gulp-rev-gqy to cache-bust several assets and generate manifest files for them. Then using gulp-rev-collector we can collect data from several manifest files and replace links to assets in html templates.

var gulp         = require('gulp');
var rev = require('gulp-rev-gqy');

gulp.task('css', function () {
    return gulp.src('src/css/*.css')
        .pipe(rev())
        .pipe(gulp.dest('dist/css'))
        .pipe( rev.manifest() )
        .pipe( gulp.dest( 'rev/css' ) );
});

gulp.task('scripts', function () {
    return gulp.src('src/js/*.js')
        .pipe(rev())
        .pipe(gulp.dest('dist/js'))
        .pipe( rev.manifest() )
        .pipe( gulp.dest( 'rev/js' ) );
});

...

var revCollector = require('gulp-rev-collector-gqy');
var minifyHTML   = require('gulp-minify-html');

gulp.task('rev', function () {
    return gulp.src(['rev/**/*.json', 'templates/**/*.html'])
        .pipe( revCollector({
            replaceReved: true,
            dirReplacements: {
                'css': '/dist/css',
                '/js/': '/dist/js/',
                'cdn/': function(manifest_value) {
                    return '//cdn' + (Math.floor(Math.random() * 9) + 1) + '.' + 'exsample.dot' + '/img/' + manifest_value;
                }
            }
        }) )
        .pipe( minifyHTML({
                empty:true,
                spare:true
            }) )
        .pipe( gulp.dest('dist') );
});

Options

collectedManifest

Type : String

It is a filename for collecded and merged manifest data in json format.

replaceReved

Type : Boolean

You set a flag, replaceReved, which will replace alredy replaced links in template's files. Default value is false.

dirReplacements

Type : Object

Specifies a directories replacement set. gulp-rev-gqy creates manifest files without any info about directories. E.c. if you use dirReplacements param from Usage example, you get next replacement:

"/css/style.css" => "/dist/css/style.css?v=1d87bebe"
"/js/script1.js" => "/dist/script1.js?v=61e0be79"
"cdn/image.gif"  => "//cdn8.example.dot/img/image.gif?v=35c3af8134"

revSuffix

Type : String

It is pattern for define reved files suffixes. Default value is '?v=[0-9a-f]{8,10}'. This is necessary in case of e.c. gulp-rename usage. If reved filenames had different from default mask.

extMap

Type : Object

If You use some methods to modify the rev_manifest.json after use gulp-rev-gqy and get a result like this:

{
    "assets/less/common.less": "assets/css/common.css?v=2c0d21e40c"
}

It means that keys and values in the rev_manifest.json have different ext : less & css.

You can define extentions maping rules for correct manifest file processing.

Default value is:

{
    '.scss': '.css',
    '.less': '.css',
    '.jsx': '.js'
}

Works with gulp-rev-collector

License

MIT © Oleksandr Ovcharenko

gqyphys(修改)