Socket
Socket
Sign inDemoInstall

requirejs-middleware

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requirejs-middleware

Connect middleware for RequireJS compiling


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

requirejs-middleware

Middleware for Connect & Express that runs the RequireJS optimizer on demand. Production-ready and used by Mozilla Popcorn Maker.

Installation

npm install requirejs-middleware

Usage

var express = require("express"),
    path = require("path"),
    requirejsMiddleware = require("requirejs-middleware");

var app = express();

app.use(express.logger("dev"));
app.use(requirejsMiddleware({
  src: path.join(__dirname + "/public"),
  dest: path.join(__dirname + "/build"),
  build: true,
  debug: true,
  modules: {
    "/main.js": {
      baseUrl: path.join(__dirname + "/public"),
      include: "main"
    }
  }
}));
app.use(express.static(path.join(__dirname + "/build")));
app.use(express.static(path.join(__dirname + "/public")));

app.listen(3000);

See the full example in examples/almond/server.js.

Options

  • src - Source directory containing the RequireJS modules. Required
  • dest - Destination directory to write built RequireJS modules to. Required
  • build - Optimize modules. When disabled, the module will be served up unchanged. Default false
  • once - Optimize modules once. Recommended for production deployments. Default false
  • debug - Output debugging information on the console. Default false
  • modules - Object containing module paths and RequireJS optimizer options. Required
    • string - Path to RequireJS module
      • baseUrl - All modules are located relative to this path. Required
      • include - Include this module in the output file. Required if you are optimizing with almond.
      • name - Name of the module to optimize first. Defaults to almond

Keywords

FAQs

Package last updated on 03 Dec 2014

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