https://github.com/clearwater-rb/roda-opal_assets
Easy Opal asset compilation for Roda
https://github.com/clearwater-rb/roda-opal_assets
assets front-end opal roda ruby
Last synced: about 1 month ago
JSON representation
Easy Opal asset compilation for Roda
- Host: GitHub
- URL: https://github.com/clearwater-rb/roda-opal_assets
- Owner: clearwater-rb
- Created: 2016-07-03T05:43:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-17T04:14:48.000Z (about 1 year ago)
- Last Synced: 2025-04-23T00:14:09.942Z (about 1 month ago)
- Topics: assets, front-end, opal, roda, ruby
- Language: Ruby
- Size: 25.4 KB
- Stars: 6
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this 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:
```ruby
gem 'roda-opal_assets'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install roda-opal_assets
## Usage
In your Roda app:
```ruby
class App < Roda
assets = Roda::OpalAssets.newroute do |r|
assets.route r# Other routes here
enddefine_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:
```slim
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](http://contributor-covenant.org) code of conduct.