cbosco / coffee-purist-brunch

Brunch with spine, LESS, eco, and mocha
4 stars 0 forks source link

common.js:61 - Uncaught Error: Cannot find module #2

Closed vanesterik closed 11 years ago

vanesterik commented 11 years ago

Hi,

I'm totally new at pre-compiling HTML5 app's and am hopefully getting better every moment. Feels a little silly and I'm sure you guys know what I'm doing wrong. But I got stuck at the require a eco-template bit. It seems CommonJS doesn't want to read or find eco templates. Does anybody know what I'm doing wrong..?

Love to hear from you, Koen

cbosco commented 11 years ago

Hi do you have an example of your project I can run to debug? Preferably a pared down one showing the problem

vanesterik commented 11 years ago

You'll have to excuse and I'm probably gonna embarras myself on my noob level.

But this is what I did..:

  1. Installed Brunch according to the instructions on the website
  2. Cloned this git-repository to a test directory
  3. Installed all needed modules by: sudo npm install
  4. Build with Brunch and after everything played along - I used Brunch watch and started developing in TextMate

First I created a new eco template (filename: Header.eco) in the app/views directory with the following markup..:

<p>Hello world</p>

Than I created a new controller (filename: Header.coffee) with the following code..:

class Header extends Spine.Controller
  constructor: ->
    super
    @html require( 'views/Header' )

module.exports = Header

And append this controller in the application.coffee file with the following code..:

Header = require( 'controllers/Header' )

class App extends Spine.Controller
  constructor: ->
    super
    @header = new Header
    @append @header

module.exports = App

Now when I view the website in Chrome with the Brunch localhost link http://localhost:3333/ - I get the following error message in the console..:

Uncaught Error: Cannot find module "views/Header" - common.js:61

I really like the structure of this repo and definitely want to start learning by getting familiar with this modules. But this issue is really getting to me and I would really appreciate any pointers you can give me.

Thanks in advance

vanesterik commented 11 years ago

Okay - it's official - I'm a total idiot.

I was just trying to make it work and started to scrutinize the codebase. Comparing other skeletons in how they were build up - apparently the config.coffee file wasn't totally in-sync with other examples I saw. Especially the 'templates' codeblock which was indented a little different than others. Just aligning it with the codeblocks above made it work..: YIHAA

Thanks for your efforts to help me out - and next time I will go a little bit further before crying for help..;)