0.3.1 • Published 9 years ago

gobble-replace v0.3.1

Weekly downloads
8
License
MIT
Repository
github
Last release
9 years ago

gobble-replace

Replace <@variables@> in text with gobble.

Installation

First, you need to have gobble installed - see the gobble readme for details. Then,

npm i -D gobble-replace

Usage

gobblefile.js

var gobble = require( 'gobble' );
module.exports = gobble( 'templates' ).map( 'replace', {
  // all instances of `<@foo@>` and `<@answer@>` in the
  // files in `templates` will be replaced
  foo: 'bar',
  answer: 42,
  object: {
    nested: 'value' // you can do `<@object.nested@>` dot notation
  }

  // supply custom delimiters
  delimiters: [ '<%=', '%>' ]

  // generate a sourcemap
  sourceMap: true
});

Or, if you want to be really anal about keeping options and variables separate...

var gobble = require( 'gobble' );
module.exports = gobble( 'templates' ).map( 'replace', {
  replacements: { foo: 'bar', answer: 42 },
  delimiters: [ '<%=', '%>' ],
  sourceMap: true
});

License

MIT. Copyright 2014-15 Rich Harris

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

10 years ago