A bundle can be created excluding Ace editor
This commit is contained in:
parent
95d74234d4
commit
6f5ea96d1a
|
@ -132,5 +132,7 @@ To create a custom build of the JavaScript code, browserify can be used:
|
|||
|
||||
browserify ./index.js -o ./jsoneditor.custom.js -s JSONEditor --ignore-missing
|
||||
|
||||
TODO: describe how to create a bundle with Ace editor excluded (accounts for 2/3
|
||||
of the total size of the library).
|
||||
The Ace editor, used in mode `code`, accounts for about 75% of the total
|
||||
size of the library. To exclude the Ace editor from the bundle:
|
||||
|
||||
browserify ./index.js -o ./jsoneditor.custom.js -s JSONEditor --ignore-missing -x brace -x brace/mode/json -x brace/ext/searchbox
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
var ace = require('brace');
|
||||
require('brace/mode/json');
|
||||
require('brace/ext/searchbox');
|
||||
require('./ace/theme-jsoneditor');
|
||||
var ace;
|
||||
try {
|
||||
ace = require('brace');
|
||||
require('brace/mode/json');
|
||||
require('brace/ext/searchbox');
|
||||
require('./ace/theme-jsoneditor');
|
||||
}
|
||||
catch (err) {
|
||||
// failed to load ace, no problem, we will fall back to plain text
|
||||
}
|
||||
|
||||
var modeswitcher = require('./modeswitcher');
|
||||
var util = require('./util');
|
||||
|
|
Loading…
Reference in New Issue