Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-requirejs-config

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-requirejs-config

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

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-17.65%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 15 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc