Skip to content

Any plans for a ruby gem that can be used with Rails asset pipeline #14

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

Open
tusharr opened this issue Feb 7, 2013 · 4 comments
Open

Comments

@tusharr
Copy link

tusharr commented Feb 7, 2013

First of all, great job on this templating engine. Really easy to use & understand syntax.

Are there any plans for a ruby gem anytime soon that be used with Rails asset pipeline?
Thanks

@malgorithms
Copy link
Owner

This is very interesting to me. Although: I have never used ruby before, other than just poking around back when RoR first started getting popular.

So I don't know what this would require. When you refer to the asset pipeline, are you talking about server-side rendering of templates, or just getting toffee templates onto the browser (for rendering client side) in a Rails project?

Toffee relies on CoffeeScript itself for evaluation the #{} regions and of course anything inside of coffeescript region: {# #}. So getting this working server-side in rails requires running JavaScript. Is there a way to execute JavaScript in ruby?

Btw, an alternative is a new templating language just like Toffee, except Ruby instead of CoffeeScript inside the appropriate regions. People might like that, too.

@tusharr
Copy link
Author

tusharr commented Feb 7, 2013

Apart from the JS templating, eco implements this for the server side as well. So, in development, I write eco templates show.jst.eco and save. When I refresh the page, the browser makes a call to the server, which ends up compiling the eco template to JS using coffescript and the eco preprocessor.

Its similar to how the coffeescript & sass files are preprocessed in the Rails asset pipeline.

I do not have the time right now to develop this, but their are quite a few examples of Rails asset-pipeline preprocessors out there.

@malgorithms
Copy link
Owner

I just took a look at eco's ruby implemention: https://github.com/sstephenson/ruby-eco ... it appears he uses a library called ExecJS to let a ruby user compile the templates via the shell and then eval them. This kind of thing should be doable with Toffee (since it also can compile templates to JS at the command line into a single package), although I prob won't get a chance to mess with this in the next couple weeks. I suspect it's easy for someone who knows what they're doing in ruby, if there are any volunteers...

-cc

@gbouthenot
Copy link

+1 for Ruby on rails integration into asset pipeline

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

No branches or pull requests

3 participants