Giter Site home page Giter Site logo

Comments (18)

leshill avatar leshill commented on July 2, 2024

Hi @twyfordr,

You should be accessing it as '_goal_steps' (see the discussion in the README https://github.com/leshill/handlebars_assets#partials).

One thing to note is that you can see the partials that have been registered with Handlebars. In the JS console, take a look at:

Handlebars.partials

That should have the partial in it.

from handlebars_assets.

twyfordr avatar twyfordr commented on July 2, 2024

I should have mentioned that I was using the JS console when troubleshooting - Handlebars.partials is empty. I do see my templates under the JST object. No partials.

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi @twyfordr,

How are you including your templates on the page? Is the template being included into application.js or another manifest file?

From the web inspector (using Chrome/Safari or Firebug in FF) you should see the template in your JS source for the page.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

My partials work in versions 0.4.4, 0.6.6, and 0.6.7, but when I upgrade to 0.7.1 I get the error Uncaught Error: The partial snapshot could not be found. Actually after git bisecting the error to that gem update, reverting back to 0.4.4, and then re-upgrading to 0.7.1, now everything works fine.

Not sure what happened to cause the error.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

I spoke too soon. I now have the same problem in prod. It works fine in dev and staging now, but I get the unknown partial error Uncaught Error: The partial snapshot could not be found in production.

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi Peter,

Interesting, please check the results of looking at Handlebars.partials in the web inspector on both development and production.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

I had to rollback production. Result from staging, running the same code as production was:

Handlebars.partials
ReferenceError: Handlebars is not defined

This is interesting. It means that the pages I have been so far able to access on staging hadn't been using handlebars, which is why I assumed staging was working. I think it was working in dev on new handlebars, with old partial syntax, but maybe that was an artifact of something else.

I now think the issue is that I upgraded and didn't know to upgrade how partials were referenced. I am doing that now.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

On dev, on a page where I know partials are used, after switching to the new syntax to render a partial at snapshots/_snapshot.hbs like this ``, I get this error:Uncaught Error: The partial _snapshots_snapshot could not be found

When I inspect as you suggested I get a list of partials that only has one file prefixed by _ and is missing almost all of my partials.
Handlebars partials

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi @pboling,

Are the rest of the files regular templates? Or just misnamed partials?

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

@leshill It is very strange. I do have a partial that has the same name as a template. Here is the full list of my templates dir:

∴ find app/assets/templates
app/assets/templates
app/assets/templates/connectors
app/assets/templates/connectors/screen.hbs.erb
app/assets/templates/connectors/screen_none.hbs
app/assets/templates/invite
app/assets/templates/invite/_invite_using_email.hbs
app/assets/templates/invite/_invite_using_facebook.hbs
app/assets/templates/invite/invite_cell.hbs
app/assets/templates/invite/screen.hbs
app/assets/templates/legacy
app/assets/templates/legacy/_convo_bubble_rest.hbs.erb
app/assets/templates/legacy/acquaintances_screen.hbs.erb
app/assets/templates/legacy/conversations_screen.hbs.erb
app/assets/templates/legacy/convo_bubble_left.hbs.erb
app/assets/templates/legacy/convo_bubble_right.hbs.erb
app/assets/templates/matches
app/assets/templates/matches/conversation.hbs.erb
app/assets/templates/matches/match_box.hbs.erb
app/assets/templates/matches/nav_locked.hbs.erb
app/assets/templates/matches/nav_thread.hbs.erb
app/assets/templates/matches/pane_conversation.hbs.erb
app/assets/templates/matches/pane_locked.hbs.erb
app/assets/templates/matches/pane_maybes.hbs.erb
app/assets/templates/matches/pane_pending.hbs.erb
app/assets/templates/matches/pane_revealed.hbs.erb
app/assets/templates/matches/pending_box.hbs.erb
app/assets/templates/matches/screen.hbs.erb
app/assets/templates/nav
app/assets/templates/nav/nav.hbs.erb
app/assets/templates/settings
app/assets/templates/settings/_email.hbs.erb
app/assets/templates/settings/_photo.hbs
app/assets/templates/settings/_photos.hbs.erb
app/assets/templates/settings/screen.hbs
app/assets/templates/shared
app/assets/templates/shared/_avatar.hbs
app/assets/templates/shared/_avatar_large.hbs
app/assets/templates/shared/snapshot.hbs
app/assets/templates/snapshots
app/assets/templates/snapshots/_snapshot.hbs
app/assets/templates/snapshots/finished.hbs
app/assets/templates/snapshots/karma_10f.hbs.erb
app/assets/templates/snapshots/karma_10f_cell.hbs
app/assets/templates/snapshots/no_snapshots.hbs.erb
app/assets/templates/snapshots/screen.hbs

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

@leshill Now if I grep that for just the partials, and compare it to my list, I am left scratching my head::

∴ find app/assets/templates | grep /_
app/assets/templates/invite/_invite_using_email.hbs
app/assets/templates/invite/_invite_using_facebook.hbs
app/assets/templates/legacy/_convo_bubble_rest.hbs.erb
app/assets/templates/settings/_email.hbs.erb
app/assets/templates/settings/_photo.hbs
app/assets/templates/settings/_photos.hbs.erb
app/assets/templates/shared/_avatar.hbs
app/assets/templates/shared/_avatar_large.hbs
app/assets/templates/snapshots/_snapshot.hbs

Handlebars partials

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi @pboling,

Have you just changed the settings/_photos.hbs file recently? It looks like only that file was actually recompiled. All the others have names from the old partial behavior.

On your dev environment, you should run rake tmp:clear to clear out any pre-compiled templates and then check.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

@leshill rake tmp:clear did not seem to have an effect. But, yes, I did change that partial in material ways recently. I am now changing them all by adding the following to each one:

<script>
  // TODO: Delete This script tag
</script>

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

After changing all my partials with the tag as above, re-running rake tmp:clear and restarting my server I am still having the exact same object returned from Handlebars.partials as before, with only the one with an _.

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi @pboling,

Just to be clear, running rake tmp:clear in development will only affect development and only if you are not putting them back into the public folder. The exact configuration escapes me at the moment, but if you have files in public/assets you will be pulling the files from there.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

Full disclosure: I am brand new to handlebars, coming into a project that makes extensive use of it with Backbone.js for the views. It uses the asset pipeline, and is on latest rails and Ruby.

And, yes I have also recently run rake assets:precompile locally... so that is fing me up.

from handlebars_assets.

pboling avatar pboling commented on July 2, 2024

WOW. You are a bad ass @leshill. Thanks for fixing me. :)

from handlebars_assets.

leshill avatar leshill commented on July 2, 2024

Hi @pboling,

No worries, this has cropped up before and nailing down what is happening and what to do to get it right is useful (and going into the README.) That said, I am being kicked out of this coffee shop.

Good luck!

from handlebars_assets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.