A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/quarterto/rfolderify below:

quarterpast/rfolderify: Rewrite rfolder calls to a map of requires

Convert any code using rfile and derivatives so that it supports browserify.

This module is a plugin for browserify to parse the AST for rfolder calls so that you can inline the folder contents into your bundles.

For a main.js

var contents = rfolder('./misc');
console.log(contents['robot'].hello());

And a misc/robot.js file.

exports.hello = function() {
    return("Beep boop");
}

first npm install rfolderify into your project, then:

$ browserify -t rfolderify example/main.js > bundle.js
var browserify = require('browserify');
var fs = require('fs');

var b = browserify('example/main.js');
b.transform('rfolderify');

b.bundle().pipe(fs.createWriteStream('bundle.js'));

You can pass an options parameter to rfolder:

var contents = rfolder('./misc', {extensions: [".coffee", ".jade"], keepExt: [".jade"]});

Valid options are:

A tiny command-line program ships with this module for easier debugging and if you just want this without any of the rest of browserify.

npm install rfolderify -g
rfolderify --help

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4