title: js-yaml - Parsing a YAML File in Javascript
body: <p>I want to parse the following file, saved as example.yml, in Javascript:</p>
  
  <pre><code>images:
      main   : [tester_tester/dic.jpg]
      red    : [tester_tester/red.jpg]
      blue   : [tester_tester/blue.jpg]
      green  : [tester_tester/green.jpg,tester_tester/green2.jpg]
  categories:
      cat1   : [Yes, No]
      cat2   : [Aa,Bb,Cc]
      cat3   : []
      cat4   : [1,2,3,4,5]
  </code></pre>
  
  <p>I am using the YAML parser in js-yaml.min.js, but I can only get it to parse strings of YAML using things like:</p>
  
  <pre><code>var fake = "images: {red: boat}\ncategories: {cat1 : []}";  
  var YAMLfile = jsyaml.load(fake);
  </code></pre>
  
  <p>and then the YAML gets stored as nested objects. How would I use this library to load and parse a YAML file instead of just giving it the string? On their website, <a href="https://github.com/nodeca/js-yaml" rel="nofollow">https://github.com/nodeca/js-yaml</a>, the API says to use the require function but this is not working. Any thoughts? </p>
  
  <p>I am essentially looking for the functionality found here: <a href="http://nodeca.github.com/js-yaml/" rel="nofollow">http://nodeca.github.com/js-yaml/</a></p>