https://github.com/tleunen/brfs-htmlmin
browserify fs.readFileSync() static html file inliner with html minifier
https://github.com/tleunen/brfs-htmlmin
Last synced: over 1 year ago
JSON representation
browserify fs.readFileSync() static html file inliner with html minifier
- Host: GitHub
- URL: https://github.com/tleunen/brfs-htmlmin
- Owner: tleunen
- License: other
- Created: 2014-09-21T19:06:26.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-07-22T00:02:04.000Z (almost 11 years ago)
- Last Synced: 2025-03-11T07:46:13.704Z (over 1 year ago)
- Language: JavaScript
- Size: 130 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# brfs-htmlmin
`brfs-htmlmin` is kind of a fork of [brfs](https://github.com/substack/brfs).
It's a transform for browserify that allows you to use `fs.readFileSync()`
in your code and will statically inline the content in your bundle.
The difference is that with `brfs-htmlmin`, it will minify the html output.
## install
- Install `brfs-htmlmin` in your project: `npm install brfs-htmlmin`
- Use it as a transform, in the command line or with the API:
```
$ browserify -t brfs-htmlmin example/main.js > bundle.js
```
``` js
var browserify = require('browserify');
var fs = require('fs');
var b = browserify('example/main.js');
b.transform('brfs-htmlmin');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
```
## example
for a main.js:
``` js
var fs = require('fs');
var html = fs.readFileSync(__dirname + '/doc.html', 'utf8');
console.log(html);
```
and a doc.html:
``` html
A RMScreenprint
Main heading in my document
Look Ma, I am coding HTML.
```
## options
#### minify
Type: `Object`
Hash of options sent to the [html-minifier](https://github.com/kangax/html-minifier). See [github html-minifier by Kangax](https://github.com/kangax/html-minifier#options-quick-reference).
By defaults, these options are already `true`:
```
removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeEmptyAttributes: true
```