yhe

yeoman-hoganjs-engine

Hogan.js templating engine with Underscore.string support for Yeoman.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

1

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

3

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

yeoman-hoganjs-engine

NPM version Build Status

Hogan.js templating engine with Underscore.string support for Yeoman.

> npm install yeoman-hoganjs-engine

Adding Hogan.js engine to your Yeoman generator

var HulkHoganGenerator = yeoman.generators.NamedBase.extend({
      engine: require('yeoman-hoganjs-engine')(), // or set your delimiters: require('yeoman-hoganjs-engine')('<%=', '%>')
      constructor: function(args, opts, config) {
        yeoman.generators.NamedBase.apply(this, args, opts);
      },
      ...
};

Using it!

Inside your generator template

Follow us at
{{#tweets}}
 <a href="http://twitter.com/{{name}}/>@{{name}}</a>
{{/tweets}}

Inside your generator action

...
writing: function () {
  this.tweets = [
      { name: 'michaelwolbert' },
      { name: 'hoganjs' },
      { name: 'yeoman' }
    ];
  this.template('_template.hogan', 'template.html');
}
...

Using Underscore.string

{{#classify}}{{myClass}}{{/classify}}

If myClass = 'myClass', then the above template would output MyClass. See below for supported Underscore.string functions.

Underscore.string

Supported functions

  • isBlank
  • stripTags
  • capitalize
  • clean
  • chars
  • swapCase
  • escapeHTML
  • unescapeHTML
  • escapeRegExp
  • join (Array based)
  • lines
  • reverse
  • succ
  • titleize
  • camelize
  • underscored
  • dasherize
  • classify
  • humanize
  • trim
  • ltrim
  • rtrim
  • words
  • slugify
  • quote || q
  • unquote
  • strip
  • lstrip
  • rstrip

Unsupported functions

  • chop
  • count
  • splice
  • insert
  • include
  • startsWith
  • endsWith
  • pad
  • lpad
  • rpad
  • lrpad
  • sprintf
  • vsprintf
  • toNumber
  • numberFormat
  • strRight
  • strRightBack
  • strLeft
  • strLeftBack
  • toSentence
  • toSentenceSerial
  • surround
  • exports
  • repeat
  • naturalCmp
  • levenshtein
  • toBoolean
  • center
  • rjust
  • ljust
  • toBool

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial