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

grunt-requirejs-config

v0.1.0

Published

grunt task to prepend a require.js config to a file

Downloads

106

Readme

grunt-requirejs-config

Write your require.js config once in your Gruntfile and prepend it to files for development

NPM version
Build Status

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide, as it explains how to create a gruntfile as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:

npm install grunt-requirejs-config --save-dev

Then add this line to your project's Gruntfile.js gruntfile:

grunt.loadNpmTasks('grunt-requirejs-config');

Documentation

Usage

Here is an example usage which allows you to set your require.js configuration once for your whole Gruntfile:

var requireShim = { 
  underscore: { 
    exports: '_'
  }
};

var requirePaths = { 
  jquery: 'libs/jquery',
  underscore: 'libs/underscore'
};

grunt.initConfig({
  requirejsconfig: {
    dev: {
      src: 'src/scripts/main.js',
      dest: 'dev/scripts/main.js',
      options: {
        shim: requireShim,
        paths: requirePaths
      }
    }
  }
});

This is what a sample src file would look like:

require(['appController'], function (AppController) {
  AppController();
});

The output dest file looks like:

// Config added by grunt-requirejs-config
require.config({
  "shim": {
    "underscore": {
      "exports": "_"
    }
  },
  "paths": {
    "jquery": "libs/jquery",
    "underscore": "libs/underscore"
  }
});

require(['appController'], function (AppController) {
  AppController();
});

This file starts the app after the config has been set.

Required properties

src

Type: String

This is file that require-config uses as your base file to prepend the configuration.

dest

Type: String

This is the destination of the generated config file.

Options

Any option will be used as a property passed to the require.js config. Here is a page describing all of the options.

Changelog

0.1.0 - Allow full function print in require.js config

0.0.2 - Called done() on async task

0.0.1 - Fixed registered task name

0.0.0 - Initial release