# oldfashionedbundler

> Bundles and minifies script tags

Latest version **1.0.1** (published 2016-08-05) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install oldfashionedbundler
pnpm add oldfashionedbundler
yarn add oldfashionedbundler
bun add oldfashionedbundler
```

Provides the command `oldfashionedbundler`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-08-05 |
| First published | 2016-08-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michiel van Eerd |
| Maintainers | michielvaneerd |

## Links

- npm: https://www.npmjs.com/package/oldfashionedbundler
- npm.io page: https://npm.io/package/oldfashionedbundler

## Dependencies (2)

- [parse5](https://npm.io/package/parse5.md) ^2.1.5
- [uglify-js](https://npm.io/package/uglify-js.md) ^2.7.0

## Recent versions

- 1.0.1 (latest) — 2016-08-05
- 1.0.0 — 2016-08-05

## README

# Extracter

Bundles all SCRIPT tags with a `data-bundle="true"` attribute and replaces
them with the resulting bundle file. Works for local and remote files.

# Usage

`npm run prod`

## Command line arguments

1) htmlSourceFile (index.html)
2) htmtDestinationFile (index-prod.html)
3) jsBundleFile (bundle.js)

So if you want to bundle the scripts in your index.html file to itself with
bundle script bundle-prod.js you would use:

`npm run prod index.html index.html bundle-prod.js`

# Attributes

You can change some behaviour with attributes:

* Only script tags with `data-bundle="true"` will be bundled 
* Script tags with `data-production-src` will be bundled with the value of this
attribute. So can be used to specify the minified version of a script. 

# Workflow

* Just use good old SCRIPT tags for your scripts
* Make use of development files
* When going to production, run the extracter on the production server.

# Notes

## BASE element

The BASE element makes the browser resolve relative URL's to the href value
of the BASE element. This bundler does *not* take this element into account.
Instead it resolves all URL's relative to the current directory where you
run the script. Normally this won't be an issue, but if it is, you can
just specify the `data-production-src` for files that would otherwise be resolved
in error.

## Order of files

Make sure the script tags to bundle are together and no no-bundle file is
between them.

__Not valid:__

This is not valid, as it would split the bundle in two (will be possible in
a next version).

```html
<script data-bundle="true" src="app.js"></script>
<script src="jquery.js"></script>
<script src="jquery-ui.js"></script>
<script data-bundle="true" src="lib.js"></script>
```

__Valid:__

```html
<script src="jquery.js"></script>
<script src="jquery-ui.js"></script>
<script data-bundle="true" src="app.js"></script>
<script data-bundle="true" src="lib.js"></script>
```

__Valid:__

```html
<script data-bundle="true" src="app.js"></script>
<script data-bundle="true" src="lib.js"></script>
<script src="jquery.js"></script>
<script src="jquery-ui.js"></script>
```

__Valid:__

```html
<script src="jquery.js"></script>
<script data-bundle="true" src="app.js"></script>
<script data-bundle="true" src="lib.js"></script>
<script src="jquery-ui.js"></script>
```

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