Comments (18)
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.
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.
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.
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.
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.
Hi Peter,
Interesting, please check the results of looking at Handlebars.partials
in the web inspector on both development and production.
from handlebars_assets.
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.
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.
from handlebars_assets.
Hi @pboling,
Are the rest of the files regular templates? Or just misnamed partials?
from handlebars_assets.
@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.
@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
from handlebars_assets.
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.
@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.
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.
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.
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 f
ing me up.
from handlebars_assets.
WOW. You are a bad ass @leshill. Thanks for fixing me. :)
from handlebars_assets.
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)
- text/x-handlebars MIME Type not supported in sprocket
- Templates not compiling at all without .jst extension
- Accessing Assets Helpers From Templates HOT 2
- Sprockets method `register_engine` is deprecated. HOT 2
- NoMethodError: undefined method `[]' for nil:NilClass HOT 1
- Not an error but still nothing in view HOT 3
- Handlebars in attribute broken in Rails by CVE-2016-6316 fix HOT 1
- handlebars outputting the javascript in the view and not rendering it. HOT 2
- Update vendored js from v4.0.5 to v4.0.10 HOT 1
- help with building vendored files from source HOT 2
- 'app.config.assets.configure' is 'undefined' in 'handlebars_assets/engine.rb' HOT 6
- Partial HBS file is not compiled into 'HandlebarsTemplates' variable HOT 5
- HandlebarsTemplates object not defined without backing model HOT 6
- allow using assets from global path instead of relative path in tests HOT 3
- changelog is missing versions HOT 1
- [NODE-SECURITY-1164] Upgrade to handlebars 4.3.0+ HOT 3
- Update Handlebars to 4.4.5 or higher for Handlebars Vulnerability HOT 1
- Sprockets v4 support HOT 5
- Mention generic options config in readme HOT 4
- Haml 6.x Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars_assets.