New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paths for .setTheme/.setMode #1518

Closed
ghost opened this Issue Jul 15, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@ghost

ghost commented Jul 15, 2013

Running editor.setTheme('libs/ace/theme/twilight') will look for theme-twilight.js in the root folder.

I tried looking at the documentation without finding any help.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 15, 2013

Also, the workers, are they required for any languages, or is there an option to turn them off?
Again, found no solution to this in the docs.

ghost commented Jul 15, 2013

Also, the workers, are they required for any languages, or is there an option to turn them off?
Again, found no solution to this in the docs.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 15, 2013

After searching for a good while I found these two:

ace.config.set('basePath', '/libs/ace');
editor.getSession().setUseWorker(false);

ghost commented Jul 15, 2013

After searching for a good while I found these two:

ace.config.set('basePath', '/libs/ace');
editor.getSession().setUseWorker(false);

@p3lim p3lim closed this Jul 15, 2013

@Quixomatic

This comment has been minimized.

Show comment
Hide comment
@Quixomatic

Quixomatic Mar 3, 2016

You are a hero, needed that basePath property and had been looking for days. Thank you.

You are a hero, needed that basePath property and had been looking for days. Thank you.

@joh-klein

This comment has been minimized.

Show comment
Hide comment
@joh-klein

joh-klein Mar 9, 2016

For future reference, this is a complete example (modeled after the embedding example on the official ace website) for having ace.js somewhere else (I had it concatenated into a libs.min.js):

<script src="libs.min.js" type="text/javascript" charset="utf-8"></script>
<script>
    ace.config.set('basePath', '/ace-builds/src-noconflict');
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai");
    editor.getSession().setMode("ace/mode/javascript");
</script>

For future reference, this is a complete example (modeled after the embedding example on the official ace website) for having ace.js somewhere else (I had it concatenated into a libs.min.js):

<script src="libs.min.js" type="text/javascript" charset="utf-8"></script>
<script>
    ace.config.set('basePath', '/ace-builds/src-noconflict');
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/monokai");
    editor.getSession().setMode("ace/mode/javascript");
</script>
@efatsi

This comment has been minimized.

Show comment
Hide comment
@efatsi

efatsi Aug 22, 2017

For anyone who struggles to get this to work in production environments, I've found that not only setting basePath, but also setting modePath and themePath are sometimes necessary for loading modes and themes:

ace.config.set('basePath', '/ace-builds/src-noconflict');
ace.config.set('modePath', '/ace-builds/src-noconflict');
ace.config.set('themePath', '/ace-builds/src-noconflict');

efatsi commented Aug 22, 2017

For anyone who struggles to get this to work in production environments, I've found that not only setting basePath, but also setting modePath and themePath are sometimes necessary for loading modes and themes:

ace.config.set('basePath', '/ace-builds/src-noconflict');
ace.config.set('modePath', '/ace-builds/src-noconflict');
ace.config.set('themePath', '/ace-builds/src-noconflict');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment