Skip to content

Commit

Permalink
Fix docs for web-support
Browse files Browse the repository at this point in the history
  • Loading branch information
styd committed Oct 1, 2024
1 parent 8bd3ced commit fa229d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/web-support/middleman.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ activate :sprockets
activate :apexcharts
```

and then require it in your `source/javascripts/site.js`.
and then require `apexcharts` in your `source/javascripts/site.js`.
```js
//= require apexcharts
```
13 changes: 7 additions & 6 deletions docs/web-support/rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,36 @@ window.ApexCharts = ApexCharts

Or, if you use `importmaps', you can:

Download to local vendor directory (optional but recommended)
1. Download to local vendor directory (optional but recommended)

```bash
$ wget -O vendor/javascript/apexcharts.esm.js https://ga.jspm.io/npm:apexcharts@latest/dist/apexcharts.esm.js`
```

Pin "apexcharts" in `config/importmap.rb` to local esm file (if you do No. 1):
2. Pin "apexcharts" in `config/importmap.rb` to local esm file if you did No. 1:

```ruby
pin "apexcharts", to: "apexcharts.esm.js"`
```
or, to CDN URL
or, to CDN URL directly if you didn't do No. 1:
```ruby
pin "apexcharts", to: "https://ga.jspm.io/npm:apexcharts@latest/dist/apexcharts.esm.js"`
```
Import and assign to window in `app/javascript/application.js`
3. Import and assign to window in `app/javascript/application.js`
```js
import ApexCharts from "apexcharts"
window.ApexCharts = ApexCharts
```
Use it with options `module: true`
4. Use it with options `module: true`
For example:
```
```erb
<% series = [{
name: "Desktops",
data: [10, 41, 35, 51, 49, 62, 69, 91, 148]
Expand Down

0 comments on commit fa229d0

Please sign in to comment.