Low commit activity in last 3 years
No release in over a year
Compile Opal assets trivially on Roda
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.5
~> 3.0
~> 13.0

Runtime

~> 1.0
>= 0
~> 3.6.0
~> 3.0
>= 0.7, < 2.0
 Project Readme

Roda::OpalAssets

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

Installation

Add this line to your application's Gemfile:

gem 'roda-opal_assets'

And then execute:

$ bundle

Or install it yourself as:

$ gem install roda-opal_assets

Usage

In your Roda app:

class App < Roda
  assets = Roda::OpalAssets.new

  route do |r|
    assets.route r

    # Other routes here
  end

  define_method(:js)         { |file| assets.js file }
  define_method(:stylesheet) { |file| assets.stylesheet file }
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:

doctype 5
html
  head
    title My App
    == js 'app'

  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.