Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could try something like this (<em>if you were using node.js</em>):</p> <pre><code>folderOrder = ['routes', 'models','fixtures', 'views', 'controllers'] fs = require 'fs' folderOrder.forEach (folder) -&gt; dir = __dirname + '/' + folder + '/' files = fs.readdirSync dir files.forEach (file) -&gt; require dir + file </code></pre> <p><br/> <strong>UPDATE</strong> </p> <p>After examining the example you linked, it seems that this has nothing to do with node. It's browser code, that uses brunch for managing build. However, in the <code>initialize.coffee</code>, there is already a commented code snippet which does exactly that, and it seems to work if you uncomment it, and comment out the 'manual' requires. I don't know why it is not used in the first place, though.</p> <p>So, initialize.coffee should contain this:</p> <pre><code># ===== Config ===== window.App = require 'config/app' require 'config/router' require 'config/store' # Load all modules in order automagically. # Ember likes things to work this way so everything is in the App.* namespace. folderOrder = [ 'routes', 'models','fixtures', 'views', 'controllers', 'helpers', 'templates' ] folderOrder.forEach (folder) -&gt; # Go through the prefixes in order and require them window.require.list().filter((module) -&gt; new RegExp("^#{folder}/").test(module) ).forEach((module) -&gt; require(module)) </code></pre> <p>After editing the file, run <code>brunch w -s</code> from the root folder and it should be working.</p>
    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. This table or related slice is empty.
    1. 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