0.5.1 • Published 11 years ago

rave-load-text v0.5.1

Weekly downloads
2
License
MIT
Repository
github
Last release
11 years ago

rave-load-text

Adds text file loading to rave.js based on file extensions.

By default, rave-load-text loads text when it detects the following file extensions:

text html txt htm

You can change this list by adding a loadText rave env property. For example, to detect ".html" and ".template" extensions, add the following to your app's bower.json or package.json:

{
	"rave": {
		"env": {
			"loadText": {
				"extensions": [ "html", "template" ]
			}
		}
	}
}

Usage

Importing a text file is easy. Just import it as if it were a module.

For CommonJS/node-formatted modules (or AMD-wrapped CommonJS):

var template = require('./template.html');
// ...
template.replace(tokensRx, findValueForToken);

For classic AMD modules:

define(['./template.html'], function (template) {
	// ...
	template.replace(tokensRx, findValueForToken);
});

For ES6-formatted modules:

import template from './template.html';
// ...
template.replace(tokensRx, findValueForToken);
0.5.1

11 years ago

0.5.0

11 years ago

0.4.0

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago