-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Combining with client-side templates, syntax compatibility #762
Comments
I usually convert my Slim templates to Pug when I need to use them client-side. It's pretty easy to do it manually as the two languages are similar (except with Pug, expressions will be interpreted as JavaScript instead of Ruby). |
Not the same thing in many cases unfortunately. The main template will often refer to server-only things (like that For now I have just been keeping JS views separate, and letting the JS find the right DOM location using an id attribute. But means those things have their views separately from the main site. Also means giving JS URLs and stuff by another channel to insert into the JS template. |
Often I have the need to do at least some of the rendering client side. But as well as really liking Slim's syntax, its often useful to still have a server-side pass (e.g. to make use of Rails helpers like
image_path/image_tag
, route helpers, etc.).For example Ive been trying out JsRender recently, and so would be nice to be able to have Slim pass through certain things.
But the
{
confuses Slim and it wont accept that indentation.{
can already be disabled as an attribute wrapper, but I cant see how to treat lines or attributes starting with{
as literal text up to a}
, or some sort of plugin interface so I can tell Slim what to do when it encounters a{
.Is there any light-weight client syntax with better compatibility?
Or scope to make it easier to tell Slim to output certain patterns as literal unescaped text in attribute and indentation contexts?
A compromise syntax style for example might be like:
The text was updated successfully, but these errors were encountered: