# node-express-bundler

> Bundle stylesheets and scripts to view

Latest version **0.0.15** (published 2015-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-express-bundler
pnpm add node-express-bundler
yarn add node-express-bundler
bun add node-express-bundler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.15 |
| Published | 2015-08-21 |
| First published | 2015-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kristine Doc |
| Maintainers | akosidoctor26 |
| Keywords | node, express, jade, html, middleware |

## Links

- npm: https://www.npmjs.com/package/node-express-bundler
- Repository: https://github.com/akosidoctor26/node-express-bundler
- Homepage: https://github.com/akosidoctor26/node-express-bundler#readme
- Issues: https://github.com/akosidoctor26/node-express-bundler/issues
- npm.io page: https://npm.io/package/node-express-bundler

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^3.10.1

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.0.15 (latest) — 2015-08-21
- 0.0.13 — 2015-08-21
- 0.0.12 — 2015-08-21
- 0.0.11 — 2015-08-21
- 0.0.1 — 2015-08-21

## README

# node-express-bundler
Middleware for bundling stylesheets and scripts to view

##Installation
```
npm install node-express-bundler
```

##Usage
```
var expressBundler = require("node-express-bundler");

expressBundler.addScriptBundle("/path/scripts", 
			["/dist/javascripts/s1.js", "/dist/javascripts/s2.js", "/dist/javascripts/s3.js"], 
			"prod");
expressBundler.addScriptBundle("/path/scripts", 
			["/development/javascripts/s1.js", "/development/javascripts/s2.js", "/development/javascripts/s3.js"], 
			"dev");

//Can switch scripts and styles between different environment by specifying the environment
app.use(expressBundler.setup("prod"));
```

Then call outputScriptBundle in template engine

```
//jade
!= outputBundle("/path/scripts")
```

Output when prod
```
"<script type='text/javascript' src='/dist/javascripts/s1.js'></script><script type='text/javascript' src='/dist/javascripts/s2.js'></script><script type='text/javascript' src='/dist/javascripts/s3.js'></script>"
```

Output when dev
```
app.use(expressBundler.setup("dev"));
```
```
"<script type='text/javascript' src='/development/javascripts/s1.js'></script><script type='text/javascript' src='/development/javascripts/s2.js'></script><script type='text/javascript' src='/development/javascripts/s3.js'></script>"
```

##Api
path (string)
filePaths (array | string)
env (string)

###addScriptBundle(path, filePaths, env)
  - returns nothing
  
###outputScriptBundle(path)
  - returns html script string
  - to be called as function in the template engine
  
###addStyleBundle(path, filePaths, env)
  - returns nothing
  
###outputStyleBundle(path)
  - returns html style string
  - to be called as function in the template engine
  
###setup(env)
  - middleware function
  - `app.use(expressBundler.setup("prod"))`

---
_Source: https://npm.io/package/node-express-bundler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
