GithubHelp home page GithubHelp logo

Comments (14)

kwhitaker avatar kwhitaker commented on May 27, 2024

Nevermind, hah. Was a naming problem. My templates were named .html.slimbars, as opposed to just .slimbars.

from handlebars_assets.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

^ reasons I wish the asset and view pipelines in rails were merged together.

from handlebars_assets.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

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.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

@wideopenspaces, What do you mean by it "neglects to ever include the compiled file" ?

from handlebars_assets.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

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.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

@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.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

Yep, I tried that one. I'll poke around a bit more to see what I can figure out.

from handlebars_assets.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

@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.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

Also what gem are you using to do "same template for both client and server-side rendering" ?

from handlebars_assets.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

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.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

Oh Okay, @wideopenspaces been there done that see: https://github.com/AlexRiedler/tilt_action_view

from handlebars_assets.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

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.

AlexRiedler avatar AlexRiedler commented on May 27, 2024

@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.

wideopenspaces avatar wideopenspaces commented on May 27, 2024

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)

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.