linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Update the handlebar compiler #251

Closed eibrahim closed 10 years ago

eibrahim commented 10 years ago

How do I tell lineman to use a new version of the handlebar compiler. I am using sub-expressions and they are only supported in handlebar 1.3. Thanks.

searls commented 10 years ago

Thanks for opening the issue. Lineman is locked to a way-too-old version of grunt-contrib-handlebars (so I'll leave this open as a note to upgrade), but in the meantime you can upgrade handlebars yourself, because any lineman dependency can be overridden by the user. All you have to do is npm i --save-dev grunt-contrib-handlebars@0.8.0 and Lineman will load it from your project's node_modules/ directory instead of loading its own (older) version.

eibrahim commented 10 years ago

I tried to do that and it still fails to compile sub expressions. haw can I confirm that it is compiling handlebars using the correct version?

davemo commented 10 years ago

Can you provide an example of a sub-expression? You can see the verbose output of each individual grunt task when using lineman with the -v flag. lineman run -v.

You can also run individual tasks with lineman grunt taskname ie: lineman grunt handlebars -v

eibrahim commented 10 years ago

I got it working by using emberTemplates settings in the config\application.js file to point to my own version. I got the info from here https://github.com/dgeb/grunt-ember-templates#templatecompilerpath-and-handlebarspath

I added this to my config\application.js

"emberTemplates": {
  "options": {
    templateCompilerPath: 'vendor/dev/ember-template-compiler.js',
    handlebarsPath: 'vendor/js/handlebars.js'
  }
},  

It compiles now and works like a charm and fyi, the expression i was compiling was this one:

      {{#each item in pages}}
        {{#link-to 'users.index' (query-params page=item.page_id) class="btn btn-default btn-sm"}}{{item.page_id}}{{/link-to}}
      {{/each}}
davemo commented 10 years ago

Nice to see you got it solved @eibrahim :)

davemo commented 10 years ago

Also, of use to you in the future may be the lineman config command which spits out configuration info and can be used to drill down to specific configurations, ie: lineman config handlebars

searls commented 10 years ago

Oh it wasn't clear at all that you were using ember. Lineman core ships with vanilla handlebars. Do you have the lineman-ember plugin installed for basic setup of the ember handlebars task?

On Thu, Apr 17, 2014 at 4:59 PM, David Mosher notifications@github.com wrote:

Nice to see you got it solved @eibrahim :)

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/251#issuecomment-40761989

eibrahim commented 10 years ago

yes, i have the ember plugin and it works great. I just wanted to upgrade my hb compilers which now works. thanks guys.

searls commented 10 years ago

Yeah sorry about the confusion. Same instructions as post 1 should have applied but for the ember hb module. 

I'll review this this weekend

On Fri, Apr 18, 2014 at 10:16 AM, eibrahim notifications@github.com wrote:

yes, i have the ember plugin and it works great. I just wanted to upgrade my hb compilers which now works. thanks guys.

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/251#issuecomment-40811528

searls commented 10 years ago

This has now been addressed by upgrading dependencies directly in lineman-ember@0.0.3