Skip to content
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

Not as easy as HAML? #1

Open
jchatel opened this issue May 2, 2020 · 2 comments
Open

Not as easy as HAML? #1

jchatel opened this issue May 2, 2020 · 2 comments

Comments

@jchatel
Copy link

jchatel commented May 2, 2020

I prefer typing PUG over HAML, mostly because I don't need to type % constantly and it feels nicer, but installing it on a simple Rails app is not as straightforward as with HAML.

With HAML, all I do is

gem 'haml', '~> 5.1.2'

And now, I can rename my views/layouts/file.html to views/layouts/file.html.haml job done

It's not working with PUG and it seems like we need to create extra files as templates with .jst. ??, am I missing something or is it really more complicated than it should be?

@yivo
Copy link
Owner

yivo commented May 2, 2020

Hello @jchatel

Sorry, it doesn't work the way you expect.

Pug is templating engine for Node.js. Ruby code can't be evaluated in such templates. So it can't be used in Rails views while HAML gem can do that because it is HAML implementation in Ruby.

The only purpose of this gem is to add ability to
a) Render Pug templates using Ruby (e.g. using Node.js VM)
b) Compile Pug templates to JS functions to be included in the JS asset file and to be used on frontend: template(locals) => HTML.

@jchatel
Copy link
Author

jchatel commented May 2, 2020

Thanks for the reply & confirming this is not possible @yivo

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

2 participants