Pulling CodeMirror

27 views
Skip to first unread message

Rafael B

unread,
Apr 14, 2013, 2:22:21 PM4/14/13
to vol...@googlegroups.com
I'm trying to add CodeMirror as a dependency.  I need 4 files from https://github.com/marijnh/CodeMirror/tree/v3.11

  • codemirror/lib/codemirror.js
  • codemirror/lib/codemirror.css
  • codemirror/mode/xml/xml.js
  • codemirror/addon/mode/overlay.js

I can pull the core js and css using: "codemirror": "github:marijnh/CodeMirror/v3.11#lib" in "dependencies",
but how would I pull also the mode and addon js files?

Guy Bedford

unread,
Apr 14, 2013, 9:38:07 PM4/14/13
to vol...@googlegroups.com
For multiple files you would probably need to just download the entire directory I believe. The single-file feature is typically just for single-file modules.


--
You received this message because you are subscribed to the Google Groups "volojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to volojs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

James Burke

unread,
Apr 15, 2013, 12:33:47 AM4/15/13
to vol...@googlegroups.com
I just put an override in the https://github.com/volojs/repos section
so that CodeMirror downloads as a directory, to match the kind of
download offered from the CodeMirror page.

So if you run `volo add codemirror` from now on, it will get the directory.

James

Rafael B

unread,
Apr 15, 2013, 4:56:22 AM4/15/13
to vol...@googlegroups.com
Thank you ! :))

Øyvind Smestad

unread,
Apr 16, 2013, 8:08:07 AM4/16/13
to vol...@googlegroups.com
I think this can be solved in a general way (not needing an override in https://github.com/volojs/repos) like this:
"dependencies": {
  "codemirror/lib": "local:/Users/osmestad/Code/CodeMirror/lib",
  "codemirror/mode/xml/xml": "local:/Users/osmestad/Code/CodeMirror/mode/xml/xml.js",
  "codemirror/addon/mode/overlay": "local:/Users/osmestad/Code/CodeMirror/addon/mode/overlay.js"
}
(I'm assuming the relative directory structure needs to be kept. If not the names can be simplified.)

This was with a local copy of CodeMirror as the override in volojs/repos seem to make it imposible to require single files from the CodeMirror repo?
At least this code seem to insist on creating extra directories (and concatenating full path as the filenames):
"dependencies": {
  "codemirror/lib/codemirror": "github:marijnh/CodeMirror/v3.11#lib/codemirror.js",
  "codemirror/lib/codemirror.css": "github:marijnh/CodeMirror/v3.11#lib/codemirror.css",
  "codemirror/mode/xml/xml": "github:marijnh/CodeMirror/v3.11#mode/xml/xml.js",
  "codemirror/addon/mode/overlay": "github:marijnh/CodeMirror/v3.11#addon/mode/overlay.js",
}
(The lib folder should probably be one request since both files are named 'codemirror', as Rafael originally did.)

One (unrelated) issue with the local code is that running 'volo add -f' to update all causes the singe file dependencies to be duplicated in package.json:
"dependencies": {
      "codemirror/lib": "local:/Users/osmestad/Code/CodeMirror/lib",
      "codemirror/mode/xml/xml": "local:/Users/osmestad/Code/CodeMirror/mode/xml/xml.js",
      "codemirror/addon/mode/overlay": "local:/Users/osmestad/Code/CodeMirror/addon/mode/overlay.js",
      "codemirror-mode-xml-xml": "local:/Users/osmestad/Code/CodeMirror/mode/xml/xml.js",
      "codemirror-addon-mode-overlay": "local:/Users/osmestad/Code/CodeMirror/addon/mode/overlay.js"
}
Which causes the last two files to be added with "long names" as well as in folders..

/Øyvind
Reply all
Reply to author
Forward
0 new messages