Skip to content

Weld-rails allows rails to use weld as a template handler.

Notifications You must be signed in to change notification settings

amiel/weld-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weld-Rails
==========

Weld-rails allows rails to use weld as a template handler.

Weld-rails is currently alpha and should not be used in production.

DESCRIPTION
===========

Currently, it can successfully compile a simple weld template using weld.js, jsdom (and it's dependencies), and Node (through ExecJS).


USAGE
=====


app/views/test/index.html.weld

    <ol>
      <li class="person">
        <span class="name">John Doe</span>
        <span class="title">Groundskeeper</span>
      </li>
    </ol>

app/views/test/index.rb

    class Views::Test < Weld::View
      def index
        {
          person: @people.collect { |person|
            { name: person.name, title: person.title }
          }
        }
      end
    end

app/controllers/test_controller.rb
    class TestController < ApplicationController
      def index
        @people = Person.all
      end
    end

Will render something like:

    <ol>
      <li class="person">
        <span class="name">John Doe</span>
        <span class="title">Gardener</span>
      </li>
      <li class="person">
        <span class="name">James Smith</span>
        <span class="title">Landscaper</span>
      </li>
    </ol>

About

Weld-rails allows rails to use weld as a template handler.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages