A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/dmapper/yamlify below:

dmapper/yamlify: YAML for browserify and node.js; YAML includes

YAML (.yaml, .yml) files support for browserify and node.
With feature to include yaml files into each other.

YAML support for browserify and node.js

Yamlify!

// server.js

var browserify = require('browserify');
var yamlify = require('yamlify');

b = browserify();
b.add('./client.js');
b.transform(yamlify);

Add ability to require YAML files in Node.js

// server.js

require('yamlify/register');

After that you can require yaml wherever you want:

// client.js or server.js

var constants = require('./constants.yaml');

This plugin also adds an ability to include yaml files into each other.

Lets say you want to keep some data in a partial file:

# _films.yaml

- &terminator
  name: Terminator 2 
  year: 1991
- name: Avatar
  year: 2009

You can include a whole .yaml file into another one like this:

# director.yaml

name: James Cameron 
films: !include ./_films 

You can also include a particular anchor from the specified file:

# me.yaml

name: John Smith
favouriteFilm: !include ./_films *terminator

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4