txtify2
v2.0.0
Published
require() text files with browserify
Downloads
8
Maintainers
Readme
txtify2
A browserify transform that lets you require()
text files.
Why
brfs is great for when you need to write javascript that will work both in node and the browser. If you're targeting only the browser though, brfs tends to be a lot of typing and personally I always forget to utf-8 decode the buffer it returns!
How
Require some text files in your browser app:
var html = require('./index.html');
console.log(html);
then build it using the browserify CLI:
browserify -t [ txtify2 -e html ] client.js > build.js
or via the API:
var b = browserify(__dirname + '/client.js');
b.transform('txtify2', { extensions: [ 'html' ] });
b.bundle(function(err, src) { console.log(src) });
or via package.json:
{
"name": "client",
"browserify": {
"transform": [
[ "txtify2", { "extensions": [ "html" ] } ]
]
}
}
Install
npm install txtify2
Test
node test
Releases
The latest stable release is published to npm. Abbreviated changelog below:
License
Copyright © 2014 Jesse Tane [email protected]
This work is free. You can redistribute it and/or modify it under the terms of the WTFPL.
No Warranty. The Software is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.