codemirror-rails icon indicating copy to clipboard operation
codemirror-rails copied to clipboard

rails 6 support

Open vpereira opened this issue 6 years ago • 3 comments

Hi, trying to update a rails from 5.2 to 6.0 and codemirror-rails is blocking it.

from bundle update rails I get the following error:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    codemirror-rails was resolved to 5.16.0, which depends on
      railties (< 6.0, >= 3.0)

vpereira avatar Aug 22 '19 09:08 vpereira

Hi @vpereira. I'm not planning on updating this gem for modern versions of Rails. This gem was created during a time long before we had official support for managing JavaScript dependencies via yarn, and it contains no other ruby code that would require it to be distributed as a gem.

If you're maintaining a Rails application that is configured with yarn, I would recommend using the official codemirror package instead.

If you haven't configured npm or yarn, and don't want to, the official codemirror releases have always been available at codemirror.net. You can download the latest release, unzip it, and copy the files you need into vendor/assets/.

fixlr avatar Aug 22 '19 13:08 fixlr

Would it be worth archiving this project to indicate that it's no longer being updated?

epugh avatar Sep 11 '22 13:09 epugh

for rails 6 without adding raw package in vendor/assets, I used npm package

app/assets/javascripts/application.js

//= require jquery
//= require codemirror/lib/codemirror

//= require_tree .

config/webpack/environment.js

const { environment } = require('@rails/webpacker')
const webpack = require('webpack')

// // Adds `var CodeMirror = require('codemirror') to legacy codemirror plugins
environment.plugins.append(
  'Provide',
  new webpack.ProvidePlugin({
    CodeMirror: 'codemirror/src/codemirror',
    CodeMirror: 'codemirror/src/codemirror',
  }),
)
module.exports = environment

package.json

"codemirror": "^5.65.9"

jaigouk avatar Sep 29 '22 13:09 jaigouk