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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loicpetitdev/gulp-data-json

v1.0.0

Published

Module to provide data to gulp-data from json files

Readme

gulp-data-json

NPM package to provide data to gulp-data from json files.

Install

Install the npm package :

npm install --save-dev @loicpetitdev/gulp-data-json

Usage

The package must be used with gulp and gulp-data packages.

Example

gulp-compile-handlebars package supports gulp-data plugin to inject data in the handlebars templates. Get HTML files from src/pages, then used gulp-data to loop through each file. Use the gulp-data-json function to get the JSON associated file of each HTML file, then gulp-data module will give these data to the next plugin : gulp-compile-handlebars.

By default, each JSON file must be at the same location with the same name of the associated HTML file. The JSON file is optionnal. Exemple :

  • src
    • pages
      • index.html
      • index.json
      • about.html

Only index.html will get data.

The globalData object is for the gulp-compile-handlebars module which enable to inject in every page global data, merged with data from the JSON if existing.

// in gulpfile.js
const { src, dest, series, parallel, watch } = require('gulp')
const data = require('gulp-data')
const jsondata = require('./scripts/gulp-data-json')
const handlebars = require('gulp-compile-handlebars')

function compile(){
    // default json data options
    const jsonDataOptions = {
        debug: false,
        src: null,
        relativeFrom: null
    }
    // handlebars global data
    const globalData = {
        debug: false,
        title: "Handlebars"
    }
    // handlebars options
    const handlebarsOptions = {
        batch: ['src/partials']
    }
    // task
    return src('src/pages/*.html')
            .pipe(data(jsondata(jsonDataOptions)))
            .pipe(handlebars(globalData, handlebarsOptions))
            .pipe(dest('dist'))
}

Debug option

{debug: true} is used to display log in order to see what happened in the module.

Src option

{src: '/my/path'} is used to search JSON files in the folder /my/path instead of next the file.

Example :

  • project
    • templates
      • file1.html
      • sub
        • file2.html
    • json
      • file1.json
      • file2.json

Files with same name will use the same json file !

RelativeFrom option

required src option

To avoid having several files with the same to use the same json file in the src directory, use relativeFrom option.

In the folloing example, src is json and relativeFrom is templates :

  • project
    • templates
      • file1.html
      • sub
        • file2.html
    • json
      • file1.json
      • sub
        • file2.json

Repository

src contains the module code. Unit tests are spec files.

test contains integration tests.

.vscode contains the Visual Studio Code configuration to debug tests.

NPM package

There are only development dependencies to test the module.

Scripts

  • test:unit runs the unit tests
  • test:int runs the integration tests
  • test runs all tests
  • watch:unit watch adn runs the unit tests
  • watch:int watch and runs the integration tests
  • watch watch and runs all tests
  • debug is used to debug the tests, used in the Visual Studio Code configuration