How To Use External Javascript Libraries
Solution 1:
Refer to the documentation.
Basic Usage The easiest way to use CodeMirror is to simply load the script and style sheet found under lib/ in the distribution, plus a mode script from one of the mode/ directories. For example:
(Alternatively, use a module loader. More about that later.)
Having done this, an editor instance can be created like this:
var myCodeMirror = CodeMirror(document.body); The editor will be appended to the document body, will start empty, and will use the mode that we loaded. To have more control over the new editor, a configuration object can be passed to CodeMirror as a second argument:
var myCodeMirror = CodeMirror(document.body, { value: "function myScript(){return 100;}\n", mode: "javascript" });
...
Solution 2:
You link opens up a new tab in my browser and I see many lines of code. Are you going to use it in some html file? Why don't you copy and paste the lines in your editor, save it and link it with
<script type="text/javascript" src="yourfile.js"></script>
(assuming your need it for your html file)
Solution 3:
You can install it in your project using NPM. For reference : https://www.npmjs.com/package/codemirror
Solution 4:
Download codemirror and store it in lib.The easiest way to use CodeMirror is to simply load the script and style sheet found under lib/ in the distribution, plus a mode script from one of the mode/ directories. For example:
<scriptsrc="lib/codemirror.js"></script><linkrel="stylesheet"href="lib/codemirror.css"><scriptsrc="mode/javascript/javascript.js"></script>
Or if you are using Node.js you can use node package manager (npm) to add the external js. just type
npm install codemirror
Please refer to https://www.npmjs.com/package/codemirror
Post a Comment for "How To Use External Javascript Libraries"