Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

m90/require-yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

require-yaml

Build Status

a transform for loading YAML files in requirejs, using js-yaml

Install the plugin and its dependencies using bower

$ bower install require-yaml --save

If you prefer a manual install, make sure to satisfy the js-yaml and text dependencies.

Simple usage

First, make sure the module names js-yaml and text resolve to the proper locations (both are installed alongside the loader when you are using bower):

requirejs.config({
    paths : {
        'yaml' : './bower_components/require-yaml/yaml',
        'js-yaml' : './bower_components/js-yaml/dist/js-yaml',
        'text' : './bower_components/requirejs-text/text'
    }
});

Now you're ready to require YAML as plain JavaScript objects:

require('yaml!some/folder/somefile.yaml', function(data){
    console.log(data); // => logs the transformed object
});

For more information see the js-yaml repository.

Build time

On build time you can simply use stubModules in your build config to get rid of the parser in the file you ship to production:

({
    stubModules: ['text','js-yaml','yaml']
})

##License MIT © Frederik Ring

About

require.js loader plugin for YAML files

Resources

Stars

Watchers

Forks

Packages

No packages published