项目作者: clearwater-rb

项目描述 :
Easy Opal asset compilation for Roda
高级语言: Ruby
项目地址: git://github.com/clearwater-rb/roda-opal_assets.git
创建时间: 2016-07-03T05:43:42Z
项目社区:https://github.com/clearwater-rb/roda-opal_assets

开源协议:

下载


Roda::OpalAssets

Simple compilation for Opal apps on the Roda web framework for Ruby.

Installation

Add this line to your application’s Gemfile:

  1. gem 'roda-opal_assets'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install roda-opal_assets

Usage

In your Roda app:

  1. class App < Roda
  2. assets = Roda::OpalAssets.new
  3. route do |r|
  4. assets.route r
  5. # Other routes here
  6. end
  7. define_method(:js) { |file| assets.js file }
  8. define_method(:stylesheet) { |file| assets.stylesheet file }
  9. end

Then you can put your Ruby and JS assets in assets/js and your stylesheets in assets/css.

Inside your views, you just need to call the js and stylesheet methods above. Here is an example layout.slim template:

  1. doctype 5
  2. html
  3. head
  4. title My App
  5. == js 'app'
  6. body= yield

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/clearwater-rb/roda-opal_assets. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.