File: README.md

package info (click to toggle)
ruby-codemirror-rails 5.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 2,716 kB
  • sloc: ruby: 73; makefile: 2
file content (99 lines) | stat: -rw-r--r-- 1,945 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# codemirror-rails

Wire up the [CodeMirror](http://codemirror.net/) assets for your Rails
applications.

## Getting Started

If you're using Bundler, you can add codemirror-rails to your Gemfile:

```ruby
gem 'codemirror-rails'
```

Or manually install the codemirror-rails gem:

```shell
gem install codemirror-rails
```

## CodeMirror for Rails >= 3.1

All of the assets from the most latest stable CodeMirror release are vendored
so that you can use them with the asset pipeline.  At a minimum, you will
probably want the following in your application.js:

```js
//= require codemirror
```

And in your application.css:

```css
/*
*= require codemirror
*/
```

### Adding a mode

Additional syntax modes can be added to your application.js:

```js
//= require codemirror/modes/ruby
```

### Adding an addon

Additional addons can be added in your application.js:

```js
//= require_tree codemirror/addons/dialog
```

And your application.css:

```css
/*
*= require_tree codemirror/addons/dialog
*/
```

### Adding a keymap

Additional keymap bindings can be added to your application.js:

```js
//= require codemirror/keymaps/vim
```

### Adding a theme

Additional CSS themes can be added to your application.css

```css
/*
*= require codemirror/themes/night
*/
```

### Precompiling Codemirror

If your project is using precompiling, depending on your method of grabbing files to precompile, you might need to add the below line to your ```` application.rb```, to get rails to precompile all js, css files used by codemirror. You can also manually whitelist only the files that you use.

```rb
config.assets.precompile += ["codemirror*", "codemirror/**/*"]
```


## CodeMirror for Rails 3

You can use the generator included with this gem to copy the CodeMirror 2
assets into your Rails 3 public directory.

```shell
rails generate codemirror:install
```
### Contributing

Find a mistake? New version of CodeMirror? Submit a pull request!