chalk-twig-filters
A twig plugin to provide filters for coloring terminal output with chalk.'
Last updated 12 years ago by tizzo .
GPL2+ · Repository · Bugs · Original npm · Tarball · package.json
$ npm install chalk-twig-filters 
SYNC missed versions from official npm registry.

Chalk Twig Filters

Build Status Coverage Status

Adds all configured chalk styles (sometimes referred to as themes) as twig.js filters.

Usage

Basic usage:

var Twig = require('twig');
require('chalk-twig-filters')(Twig);

That's it! Now you can use twig to render colored text for the console like so:

var Twig = require('twig');
require('./index')(Twig);
var someObject = {
  message: 'something wicked this way comes',
  date: new Date().getTime(),
};
var template = Twig.twig({data: '{{ date | date("m/d/Y h:m:s") | blue | underline}}: {{ message | cyan }}'});
console.log(template.render(someObject));

Advanced usage:

If you're doing anything clever like custom themes in chalk you can hand in the chalk instance to use. All styles should be automatically detected and filterified dynamically. All you have to do is hand in chalk as a second argument.

var Twig = require('twig');
var chalk = require('chalk');
// Configure chalk, add some theme combo, etc...
require('chalk-twig-filters')(Twig, chalk);

Current Tags

  • 0.0.3                                ...           latest (12 years ago)

3 Versions

  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 9
Today 4
This Week 6
This Month 9
Last Day 0
Last Week 2
Last Month 0
Dependencies (1)
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE