Skip to content

Commit

Permalink
Add support for middleman app
Browse files Browse the repository at this point in the history
  • Loading branch information
styd committed Oct 1, 2024
1 parent 899e002 commit fce2243
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/web-support/middleman.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Middleman

Make sure you have `middleman-sprockets` in your `Gemfile`
```ruby
gem 'middleman-sprockets'
gem 'apexcharts'
```
Don't forget to `bundle install`.

Activate them in `config.rb`
```ruby
activate :sprockets
activate :apexcharts
```

and then require it in your `source/javascripts/site.js`.
```js
//= require apexcharts
```
11 changes: 11 additions & 0 deletions lib/apex_charts/support/middleman.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class ApexCharts::Middleman < Middleman::Extension
def initialize(app, options_hash={}, &block)
super
end

helpers ::ApexCharts::Helper
end

::Middleman::Extensions.register(:apexcharts, ApexCharts::Middleman)
1 change: 1 addition & 0 deletions lib/apexcharts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
require 'apex_charts/helper'
require 'apex_charts/support/rails' if defined? Rails
require 'apex_charts/support/sinatra' if defined? Sinatra
require 'apex_charts/support/middleman' if defined? Middleman::Extension

0 comments on commit fce2243

Please sign in to comment.