bartsqueezy / ember-handlebars-brunch

This Brunch plugin adds support for pre-compiling Ember Handlebars templates prior to runtime
MIT License
9 stars 32 forks source link

Having trouble running the test #2

Open sanfordredlich opened 11 years ago

sanfordredlich commented 11 years ago

Hi, thanks for working on this. I'd like to add the ability to compile Jade in the Handlebars templates.

To do this, I plan to add this code, which worked fine for me when done directly in the code:

cd ember-handlebars-brunch/
npm install --save jade
add this to index.js
jade = require('jade');
…
var content, error, result, tmplName, tmplPath, 
...
jadeOutput;
if (this.precompile === true) {
          jadeOutput = jade.compile(data.toString(), {
            compileDebug: true,
            filename: tmplPath
          });

 content = compileHBS(jadeOutput());

In trying to do this, I had trouble running the tests. My steps were

git clone https://github.com/bartsqueezy/ember-handlebars-brunch.git
cd ember-handlebars-brunch/
npm install
npm test

result: "error: cannot find module 'handlebars'"

So I updated test/plugin_test.js to have this: "var Handlebars = require('../vendor/handlebars');"

Then I get this error: " 1) plugin "before each" hook: typeerror: cannot read property 'templates' of undefined at new emberhandlebarscompiler (/users/s.redlich/documents/testembertoss/ember-handlebars-brunch/lib/index.js:26:28)"

Questions:

Thanks for any tips,

bartsqueezy commented 11 years ago

@sanfordredlich, the unit tests for this plugin have not been kept up-to-date for quite some time now. Updating existing and creating new tests was the next thing on my to-do list for this week. Obviously, adding support for Jade within Handlebars templates would require modifying these tests, if not creating new ones altogether.

I'll start looking into these errors your having tonight and let you know what I come up. Thanks!

sanfordredlich commented 11 years ago

Cool, thanks for any help. I haven't looked at this before so I wasn't even sure what the proper procedure is for running the tests (npm test?). My other key question is: "Is there a graceful way to add the Jade precompilation step without forking ember-handlebars-brunch? I was hoping that Brunch could do multiple precompilation steps in a series but I don't see a way to do that." I assume there isn't a way to chain precompilation steps, so the only way I can add Jade is to fork this code and add it per my note above. Is that correct? Thanks, - S.

sanfordredlich commented 11 years ago

PS - I'm back on the internet after traveling so I should be able to respond more quickly.

bartsqueezy commented 11 years ago

Looks like we've been playing tag. Just got back myself from a week of travel. Picking up where I left off on this. Sorry for the wait.

sanfordredlich commented 11 years ago

No worries, Steve, thanks. I'm actually diving into Angular research at the moment and I'm still in Berlin, so we're in tune. ;)

On Jun 3, 2013, at 6:33 AM, Steve Bartnesky notifications@github.com wrote:

Looks like we've been playing tag. Just got back myself from a week of travel. Picking up where I left off on this. Sorry for the wait.

— Reply to this email directly or view it on GitHub.