Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="https://github.com/jamesknelson/meteor-yaml" rel="nofollow">meteor-yaml</a> package makes this easy - it automatically loads any .yaml files in your project, parses them into JavaScript objects, and makes them available in YAML.data.</p> <p>In my application I have some code outside of the meteor app that needs the same settings, so I prefer to have the config file outside of the meteor project directory. Then I load the file like this:</p> <pre><code>var fs = Npm.require('fs'); fs.readFile('&lt;path to file&gt;.yaml', 'utf8', function(err, data) { if(err) { //Throw exception if the file is missing throw new Error("Missing config file") } else { //Read the file into a JavaScript object config = YAML.parse(data); } }); </code></pre> <p>Unfortunately, the meteor-yaml package is a little out of date with how the meteor team wants node packages to be loaded now, so if you're using a recent version of meteor the package won't work out of the box.</p> <p>I filed a <a href="https://github.com/jamesknelson/meteor-yaml/issues/2" rel="nofollow">bug</a> about this, but in the meantime to get around it I installed it as a <a href="http://www.meteor.com/blog/2013/04/04/meteor-060-brand-new-distribution-system-app-packages-npm-integration" rel="nofollow">private package</a>, as opposed to installing it from atmosphere, and fixed the bug. To do this:</p> <ol> <li>Clone the repo under your projects packages/ directory</li> <li>Comment out the Npm.require lines. </li> <li><p>Add a call to depends:</p> <p>Npm.depends({yamljs: "0.1.4"});</p></li> <li><p>Run meteor. Meteor will detect the meteor-yaml private package and install the dependencies.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload