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

bootstrap-grunt

v0.0.2

Published

bootstrap-grunt help you to organize your Gruntfile, splitting it into small files.

Downloads

9

Readme

bootstrap-grunt

NPM

Introduction

bootstrap-grunt help you to configure Grunt in a maintainable way.

Grunfile grows out of control easily. bootstrap-grunt break up Grunfile into many small-reusable files with tasks & config.

Guntfile.js


module.exports = function (grunt) {

    var path = require("path"),
        bootstrap = require("bootstrap-grunt");

    bootstrap(grunt)
        // --------------
        // Initial configuration
        .setConfig({
            banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
                ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n */\n',
            src: {
                docs: "<%= pkg.directories.docs %>",
                css: "<%= pkg.directories.source.css %>",
                js: "<%= pkg.directories.source.js %>",
                specs: "<%= pkg.directories.test.casperjs %>",
                html: "<%= pkg.directories.source.html %>"
            }
        })

        // load package.json and store it's contents in <configuration>.pkg
        // loadPackageJSON(String absolute_path)
        .loadPackageJSON(path.join(__dirname , 'package.json'))

        // if you need to do something with the configuration before loading dependencies
        // config(Function callback(Object config, Object package_json))
        .config(function(config, package_json) {
            package_json.directories.source.js =
                bootstrap.expandFiles(package_json.directories.source.js);
        })

        // --------------
        // loading your plugins

        // from package.json -> .devDependencies load all grunt-*
        .loadDevDependencies()

        // from package.json -> .dependencies load all grunt-*
        .loadDependencies()

        // alternative method: .config(function(){ require('load-grunt-tasks')(grunt); })

        // --------------
        // Loading your configuration/tasks
        // loadConfiguration(Array from, Object options);
        // options has only "json_comments" atm.

        // *.js are required and execute it
        // Arguments passed: grunt, config, bootstrap

        // *.json are treated as config extensors
        // *.yml are treated as config extensors

        .loadConfiguration([path.join(__dirname , 'grunt/*')], {json_comments: true})

        // init Grunt
        .initConfig();
    // RIP Gruntfile.js
};

task: print.js


module.exports = function(grunt, config, bootstrap) {
    // set configuration or use YML/JSON instead your choice!
    bootstrap.merge({
        print: {
            es: { options: { lang: "Hola!"}},
            en: { options: { lang: "Hello!"}},
        }
    });

    // register tasks normally
    grunt.registerMultiTask('print', 'Increment HTML version', function () {
        var options;

        switch(this.target) {
            case "es":
                options = this.options({ lang: "Adios!"});
                break;
            case "en":
                var options = this.options({ lang: "Bye!"});
                break;
        }

        grunt.log.debug("In config: ", config.print[this.target].options.lang);
        grunt.log.debug("In options: ", options.lang);
    });
};

config: print.yml

print:
    es:
        options:
            lang: "Hola!"
    en:
        options:
            lang: "Hello!"

config: cssmin.json

{
    "cssmin": {
        "dist": {
            "expand": true,
            "cwd": "public/css/",
            "src": ["*.css", "!*.min.css"],
            "dest": "public/css/",
            "ext": ".min.css"
        }
    }
}

license

MIT.