@pamorana/express-jquery
A middleware to serve jQuery, for Express
Last updated 2 years ago by joel-ericsson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @pamorana/express-jquery 
SYNC missed versions from official npm registry.

express-jquery

license npm npm

const express = require('express');
const expressJQuery = require('@pamorana/express-jquery');
const app = express();

app.use('/js', expressJQuery({
    full: true,
    slim: true,
}));

app.listen(3000);

Installation

Install express-jquery as well as a jQuery version of your choice.

Using yarn

yarn add @pamorana/express-jquery jquery@latest

Using npm

npm install @pamorana/express-jquery jquery@latest --save

Documentation

Set up an Express app

const express = require('express');
const expressJQuery = require('@pamorana/express-jquery');
const app = express();

app.listen(3000);

Options

The default options will serve both the full and slim build of jQuery in their respective minified form.

Option Description Type Default
full Wheter to serve the default version of jQuery, both unminifed and minified versions. Boolean
full Same as above but gives control of which veresion should be served. First value is unminifed, second is minfied. Boolean[] [false, true]
slim Wheter to serve the slim version of jQuery, both unminifed and minified versions. Boolean
slim Same as above but gives control of which veresion should be served. First value is unminifed, second is minfied. Boolean[] [false, true]

Where are the files served?

Given the topmost example, files will be served directly in the /js route:

File Full build Slim build
Unminified example.com/js/jquery.js example.com/js/jquery.slim.js
Minified example.com/js/jquery.min.js example.com/js/jquery.slim.min.js
Map example.com/js/jquery.min.map example.com/js/jquery.slim.min.map

Examples

Serve all builds

app.use(expressJQuery({
    full: true,
    slim: true,
}));

Serve only minifed bulids

app.use(expressJQuery({
    full: [ false, true ],
    slim: [ false, true ],
}));

Serve only unminifed builds

app.use(expressJQuery({
    full: [ true, false ],
    slim: [ true, false ],
}));

Serve only full build

app.use(expressJQuery({
    full: true,
}));

Serve only slim build

app.use(expressJQuery({
    slim: true,
}));

Contributing

File an issue or even better create a merge request.

License

MIT © Pamorana and contributors.

Current Tags

  • 1.0.5                                ...           latest (2 years ago)

6 Versions

  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 6
This Month 12
Last Day 0
Last Week 6
Last Month 8
Dependencies (2)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |