browserify compatible version of the ace editor.
npm install brace
|40||downloads in the last day|
|229||downloads in the last week|
|323||downloads in the last month|
|Version||0.2.1 last updated 7 days ago|
|Keywords||ace, editor, browser, package, bundle, inline, browserify|
|Dependents||gardr-validator-web, pasties-validator-web, scriptie-talkie-embed|
This badge shows which browsers support annotations, however the editor itself works in pretty much every browser.
npm install brace
Include the above as an entry in your browserify build, add a
This editor will show error/warning annotations if your browser supports WebWorkers created via a blob URL (see testling support badge on top).
Please consult the detailed example for more information.
Why not just use ace?
The ace editor creates the WebWorker via a worker script url. This requires the worker scripts to reside on your server and forces you to host the ace editor on your server as well.
While that is ok in most cases, it prevents you from providing a fully working ace editor package.
With brace, you have two options:
- include brace itself when browserifying your app to get a fully working ace editor included with your bundle (no other external scripts needed)
- create the bundle as explained above and provide it to others so they can include it in their html page simply via a script tag
What if my browser doesn't support it?
If brace is unable to inline the web worker, it just falls back to provide the ace editor without annotation support. This means the editor is fully functional, but doesn't display errors/warnings on the left side.
As far as I understand, the original ace editor behaves in exactly the same way.
How does it work?
- inline all supported workers
- automatically require the workers that a 'mode' (language) depends on inside the mode file itself
- provide the modes and themes at the same paths that ace's
setThemeuse (just replace 'ace' with 'brace') as seen in the above example
All workers included with ace are supported, except
xquery, mainly because I wasn't able to properly
stringify their code (any help with that is appreciated).
npm explore brace npm test