Code Monkey home page Code Monkey logo

antimatter's Introduction

antimatter NPM version

Annihilate YAML front matter.

Getting Started

To install the module with npm, run the following in the command line:

npm i antimatter --save

To install with bower, run:

bower install antimatter --save

Use within your application with the following line of JavaScript:

var antimatter = require('antimatter');

Options

custom delimiters

Type: String

Default: {close: '---', open: '---'}

Open and close delimiters can be a string or an array of strings. If an array of strings is passed for a delimiter then all patterns supplied will be used to check for YAML front matter.

For example, this:

{
  close: '~~~',
  open: '~~~'
}

Would strip this from files:

~~~
title: I'm still front-matter
description: Tilde's are people too!
~~~

<h1>Not me though, I wouldn't be stripped.</h1>

Example usage

var file = require('fs-utils')
var antimatter = require('antimatter');
var glob = require('globule');

var globOpts = {
  ext: '.html',
  srcBase: 'templates',
  destBase: 'foo',
  matchBase: true,
};

glob.findMapping('**/*.html', globOpts).map(function(fp) {
  var src = file.readFileSync(fp.src);
  file.writeFileSync(fp.dest, antimatter(src));
});

Jon Schlinkert

Related

  • helpers: some great handlebars helpers that we decided not to include in the handlebars-helpers project, most likely because the code footprint was too big or the helper wasn't generic enough.

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license

antimatter's People

Contributors

jonschlinkert avatar

Stargazers

Cat  avatar  avatar

Watchers

 avatar Brian Woodward avatar  avatar

antimatter's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.