A bundle can be created excluding Ace editor

This commit is contained in:
jos 2015-02-28 15:21:01 +01:00
parent 95d74234d4
commit 6f5ea96d1a
2 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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');