Search code examples
javascriptgulpeditorace-editor

Ace editor and minimized files


I use gulp to minimize all my js files and rename it to filename.min.js standard and copy to the production folder. But in that case the ACE library can't load theme and mode, because the folder doesn't include files: theme-terminal.js and mode-javascript.js, only theme-terminal.min.js and mode-javascript.min.js

editor.setTheme('ace/theme/terminal');
editor.session.setMode('ace/mode/javascript');

Is there is any method to fix this problem?


Solution

  • ace relies on names of files to load themes modes and extensions of demand. If you cannot change your code to not rename ace files, you can configure ace to use different names like this:

    var basepath =  ace.config.get("basePath"); 
    ace.config.setModuleUrl("ace/theme/terminal", basepath + "/theme-terminal.min.js");
    editor.setTheme('ace/theme/terminal');