Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight modifications for jam.js support (partially fixes #79) #86

Merged
merged 2 commits into from
Jan 29, 2013

Conversation

nfriedly
Copy link
Contributor

I told jam the package name is "hbs" so that the plugin is hbs!, and I rewrote the dependencies to use relative urls. The reason It's only a partial fix because there's currently no way to configure it for jam compile at the moment - see caolan/jam#127

(And, of course, you'd need to create a jam account and publish it.)

I kept the dependencies included in the package, although we could update it to use jam-provided coppies of underscore and json2 (and possibly handlebars) if we wanted.

…hough there's no way to configure it for jam compile at the moment - see caolan/jam#127 ). This commit keeps the dependencies included in the package, although we could update it to use jam-provided coppies of underscore and json2 (and possibly handlebars)
@nfriedly
Copy link
Contributor Author

Woop, I was expecting it to automatically link to #79 with the #79

@nfriedly
Copy link
Contributor Author

Of course.. now the auto linking works.

…s to use. At this point, jam can compile with this plugin as long as you're using default hbs settings
@nfriedly
Copy link
Contributor Author

I realized that without Handlebars.js at the top-level, the jam compile fails because the compiled templates just depend on 'handlebars' with no path info. So, it's now including http://jamjs.org/packages/#/details/handlebars which is one version behind you and two versions behind the current release ( 1.0.rc.2 - https://github.com/wycats/handlebars.js/tree/master/dist ) - but everything seems to be working fine.

@mic0331
Copy link

mic0331 commented Jan 29, 2013

👍

@SlexAxton
Copy link
Owner

So this is good to merge?

@SlexAxton SlexAxton mentioned this pull request Jan 29, 2013
@nfriedly
Copy link
Contributor Author

Yep, I think so. I'm now using my branch instead of yours - the code's in QA right now and will be in production soon. There's room for improvements, but I think you could merge this in right now and publish the results to jam.

I think the biggest issues is configuration - that will have to be fixed within jam.

SlexAxton added a commit that referenced this pull request Jan 29, 2013
Slight modifications for jam.js support (partially fixes #79)
@SlexAxton SlexAxton merged commit 6dcbbf0 into SlexAxton:master Jan 29, 2013
@mic0331
Copy link

mic0331 commented Jan 30, 2013

What is the setup to use in package.json ?

for now i just add this "hbs": "*" in the dependencies of the jam option.
Is there something else to add ?
When i'm testing I'm getting errors around line 466 of hbs.js, probably a missing config ?

Thanks for your support

@SlexAxton
Copy link
Owner

I'm not a jam user, but I'd bet you can just copy the hbs section from the app.build.js file in this repo and add it to your config, wherever that is.

@nfriedly
Copy link
Contributor Author

@mic0331 that's where it's trying to load your language file for i18n. Unfortunately there's no way to disable that in jam, it's just set to whatever the default is (on, in this case). For the moment, you just have to create a template/i18n/en_us.json language file and make the content look like this:

{}

@SlexAxton do you want to try and handle this before jam gets fixed to support configuration? I can think of a few possible solutions:

  • Disable i18n by default
  • Disable i18n if the language file doesn't exist and the settings are default. Maybe log a warning here.
  • Remove i18n from this package and add it to another. Have the two work together if i18n is present, otherwise it's disabled and we're just parsing templates.

I honestly like option 3 the best, but it's also the most work. What do you think?

@SlexAxton
Copy link
Owner

I'm cool with option 3, but will take more time. Until then, option 1 seems the best, but ruins the 'demo' part of the repo. So maybe number 2 is better? Wanna pull request?

@nfriedly
Copy link
Contributor Author

I'll try and get # 2 done today, I'm just a little squeezed for time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants