-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add server-side evaluation #4
Comments
Do you not like chaining
It doesn't support routing helpers out-of-the-box, but you posted this a while ago, right? (I wonder why Rails isn't doing that by default.) With Erb being an easy solution, I'm not really sure if this problem is worth complicating the language with a notion of a server-side context. |
And I think you can also do
|
Ugh, I hate it. If I wanted an ugly syntax I'd be using ejs. :) |
Haha, I know what you mean. :) I can personally live with it since it tends to be just a few lines in a longish file, but if it bothers you ... |
One occasionally wants to use Rails helper methods (especially asset and route helpers) in client-side templates. Existing solutions are ugly.
The fact that Skim is implemented in Ruby and compiles server-side affords a unique solution: server-side evaluation within the language. I'm thinking of adding two new sigils:
~
and≈
, server-side analogs of-
and=
. (Think of~
as a sideways S, for Server.) Within these sigils, you write Ruby instead of CoffeeScript. You are responsible for keeping your template logic simple enough that writing in two different embedded languages doesn't become confusing.Example:
my_path
andimage_tag
would be evaluated at compile time, generating the equivalent of:Maybe ≈ isn't the best choice, as it's hard to type and forces the encoding issue. But you get the idea.
The text was updated successfully, but these errors were encountered: