@pamorana/express-jquery
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

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.

Package Sidebar

Install

npm i @pamorana/express-jquery

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

30.4 kB

Total Files

9

Last publish

Collaborators

  • joel-ericsson