Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use CodeMirror with Rails

License

NotificationsYou must be signed in to change notification settings

flockler/codemirror-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

173 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wire up theCodeMirror assets for your Railsapplications.

Getting Started

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

gem'codemirror-rails'

Or manually install the codemirror-rails gem:

gem install codemirror-rails

CodeMirror for Rails >= 3.1

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

//= require codemirror

And in your application.css:

/**= require codemirror*/

Adding a mode

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

//= require codemirror/modes/ruby

Adding an addon

Additional addons can be added in your application.js:

//= require_tree codemirror/addons/dialog

And your application.css:

/**= require_tree codemirror/addons/dialog*/

Adding a keymap

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

//= require codemirror/keymaps/vim

Adding a theme

Additional CSS themes can be added to your application.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.

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

CodeMirror for Rails 3

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

rails generate codemirror:install

Contributing

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

About

Use CodeMirror with Rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby71.9%
  • HTML20.8%
  • JavaScript3.8%
  • CSS3.1%
  • Roff0.4%

[8]ページ先頭

©2009-2026 Movatter.jp