I am trying to load an ace theme from a CDN with requirejs.
Here is a plunkr which illustrates my problem. The theme can not be found in the following case:
requirejs.config({
paths: { ace: ['//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/'] }
})
$('h1').text("loading ace...");
requirejs([ 'ace/ace'], function(ace) {
$('h1').text("ace loaded.")
console.log(ace)
editor = ace.edit('editor')
editor.setTheme("ace/theme/monokai")
return
})
Note: I asked this question to load ace editor with requirejs from CDN, but it does not explain how can I load an ace theme.
Seems like there is a bug in ace, and one needs to call
ace.config.set("packaged", true)
ace.config.set("basePath", require.toUrl("ace"))
before ace.edit
to configure paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With