GithubHelp home page GithubHelp logo

yamlify's Introduction

yamlify

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');

YAML files inclusions

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

licence

MIT

yamlify's People

Contributors

cray0000 avatar erikvold avatar stolksdorf avatar zag2art avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yamlify's Issues

Unexpected token

I'm having trouble using this transform in a watchify setup.

SyntaxError: Unexpected token (1:6) while parsing file: /src/process/processes.yaml

TypeError: require.extensions is not an object

I get this error when using the library in conjunction with browserify through gulp.

I am setting the transforms, aswell as including the library in my gulpfile and including the helper in the only file that tried to load yaml.

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.