Skip to content

Inline templates #4

Closed
Closed
@skyksandr

Description

@skyksandr

First of all - @joelhawksley Thank you! The missing part of Rails I was googling so badly 😄

I have an idea about templates - instead of defining it as a method with heredoc, use the same approach as Sinatra's inline templates can be better
https://github.com/sinatra/sinatra#inline-templates

as, for example, we can define styles in the same place like:

class OurComponent
  def hello_message
    "Hello, world!"
  end

  ...
end

__END__

@@template
<div class="title"><%= hello_message %></div>

@@styles
.title {
  font-size: 24px;
}

Related code from Sinatra repo can be found here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions