Skip to content

Commit ec2cd1a

Browse files
Merge pull request #1 from railsjazz/feature/add-webpack-installation-guide
Add installation guide for webpack
2 parents eca20bd + 863f423 commit ec2cd1a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,36 @@ $ bundle
7171
7272
2) start using :)
7373
74+
### Webpack / esbuild
75+
76+
1) Run:
77+
78+
```bash
79+
yarn add echarts
80+
```
81+
82+
#### For Rails 7
83+
2) In `app/javascript/application.js` add this:
84+
85+
```javascript
86+
import * as echarts from 'echarts';
87+
import 'echarts/theme/dark';
88+
89+
window.echarts = echarts;
90+
```
91+
92+
#### For Rails 6
93+
2) In `app/javascript/packs/application.js` add this:
94+
95+
```javascript
96+
import * as echarts from 'echarts';
97+
import 'echarts/theme/dark';
98+
99+
window.echarts = echarts;
100+
```
101+
102+
3) start using :)
103+
74104
### Importmaps
75105
76106
1) change `config/importmap.rb`
@@ -98,7 +128,7 @@ import "rails_charts/echarts.min.js"
98128
## Options
99129
100130
```ruby
101-
<%= link_chart data, {
131+
<%= line_chart data, {
102132
width: '250px',
103133
height: '250px',
104134
theme: 'dark',

0 commit comments

Comments
 (0)