Comments (14)
Nevermind, hah. Was a naming problem. My templates were named .html.slimbars
, as opposed to just .slimbars
.
from handlebars_assets.
^ reasons I wish the asset and view pipelines in rails were merged together.
from handlebars_assets.
Is there any way to make using .html.hbs work? I am using the same template for both client and server-side rendering, and the solution I came up with requires it to be named {action}.html.hbs ..HBA compiles it just fine, but neglects to ever include the compiled file.
If I copy and paste the compiled template into the console, everything's hunky-dory.
If I can't figure out the extension piece... well, I'll have to figure out how to stop Rails from rendering my JSON response with the handlebars template :/
from handlebars_assets.
@wideopenspaces, What do you mean by it "neglects to ever include the compiled file" ?
from handlebars_assets.
I think 'require_tree' skips it, because the compiled file ends up with the name 'show.html' ... if I can figure out a way to strip all extensions instead of just the last, I imagine it would be written out to 'show.js' and be properly included.
from handlebars_assets.
@wideopenspaces; make handlebars register the combined extension might work as in ".html.hbs" instead of the default. If that doesn't work I can see what I can do.
from handlebars_assets.
Yep, I tried that one. I'll poke around a bit more to see what I can figure out.
from handlebars_assets.
@wideopenspaces are you on the latest version that came out this weekend? make sure to clear your rails cache when testing (I know,.... its really annoying to test).
from handlebars_assets.
Also what gem are you using to do "same template for both client and server-side rendering" ?
from handlebars_assets.
I was working on my fork of @variousauthor's fork with support for server-side rendering, attempting to make it work cleanly with render_with
... I got it working (as an aside, I lost an entire weekend to the innards of ActionView and ActionController mysteries): https://github.com/wideopenspaces/handlebars_assets/compare/adds_responder
When I came up for air, you'd released the brand new version. I was going to attempt to get things working on the old version, then pull the new version and see if I could port them over.
from handlebars_assets.
Oh Okay, @wideopenspaces been there done that see: https://github.com/AlexRiedler/tilt_action_view
from handlebars_assets.
I wandered through Sprockets. The answer was staring me in the face in the code.
If I name the template show.jst.hbs
, Sprockets saves the compiled template as show.jst
, which it is more than happy to include. I just had to adjust my code to look for formats: [:js, :jst]
instead of formats: [:html]
, and remove jst.hbs
from the list of extensions that get the custom ActionView renderer.
(The reason for the last part is this: if jst.hbs
is registered to a custom renderer in ActionView, the .jst part of the extension is not seen as a format extension)
from handlebars_assets.
@wideopenspaces good job, now I just need to document it ...; the only major code change in the new version fyi is a file rename (since the old name is not consistent with other ruby tilt libraries).
from handlebars_assets.
I'm pretty sure the one I forked from is at least a few generations back, but that won't stop me!
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.