package
require() text files with browserify
npm install txtify2GitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A browserify transform that lets you require() text files.
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!
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.jsor 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" ] } ]
]
}
}npm install txtify2
node test
The latest stable release is published to npm. Abbreviated changelog below:
Copyright © 2014 Jesse Tane jesse.tane@gmail.com
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.
Estimated unpacked size across 13 packages.
608.3 kB
Includes dependencies.
3 direct · 2 outdated