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

getsmart-js

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getsmart-js

Middleware for express.js. Compresses, minifies and concats JavaScript and CoffeeScript at runtime.

  • 0.2.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

getsmart-js

Middleware for Express.js, a Node.js framework. Compresses, minifies and concats JavaScript and CoffeeScript at runtime.

What it does

getsmart-js intercepts GET requests for files ending in ".js". It checks to see if the modification date of the source file has changed since the last request, and updates the file if it has.

It optionally compresses and minifies the file (using uglify-js) – good for production.

If a request is made, and the source file is not found, getsmart-js looks for a folder with the same name as request (minus the '.js') and concatenates all files in that folder (including sub-folders). eg. Request URL is "app.js", but "app.js" is not in the source folder, so getsmart-js looks for a folder named "app".

Installation

Run "npm install getsmart-js" to install the module.

Usgage

Use getsmart-js as a middleware for Express.js.

eg. app.configure(function(){ app.use(require('getsmart-js')({ compress: true, isProduction: false, src: __dirname })); };

Options

compress Boolean (optional) Whether to compress & minify or not. Defaults to NODE_ENV == 'production'.

isProduction Boolean (optional) Will only check modification dates the first run if true. Defaults to NODE_ENV == 'production'.

src String (required) The source directory of the source JavaScript files.

Notes on Directories

The file paths will include the request URL – so you must keep this in mind when setting the options.

eg. request URL = "/js/app.js", so getsmart will look for "app.js" inside the "js" folder in the source directory.

FAQs

Package last updated on 24 Aug 2013

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