Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

rcu-builders

Utilities to convert Ractive component files into JavaScript modules. This is designed to be used by component loaders such as gobble-ractive - unless you're creating a component loader, this probably isn't what you're looking for.

Installation

npm i rcu-builders

Usage

var rcu = require( 'rcu' );
var builders = require( 'rcu-builders' );
var Ractive = require( 'ractive' );

// Initialise ractive component utils
rcu.init( Ractive );

module.exports = function createModule ( source ) {
	var definition = rcu.parse( source );

	// there are three builders - AMD, CommonJS, ES6
	var amdModule = builders.amd( definition );
	var cjsModule = builders.cjs( definition );
	var es6Module = builders.es6( definition, options );

	// ...
}

Options

Currently only the ES6 builder supports any options. They are:

  • sourceMap – whether or not to create a sourcemap
  • sourceMapFile and sourceMapSource – populate the file and sources members of the sourcemap
  • preserveExtensions – whether to preserve the file extensions for imported components

License

MIT. Copyright 2015 Rich Harris

About

Utilities to convert Ractive component files into JavaScript modules

Resources

Packages

No packages published