-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Concatenating js into one file, not finding the jsoneditor theme & mode files #157
Comments
Yes, I would love to bundle these files inside jsoneditor.js. So far it didn't work because Ace editor tries to load these files dynamically, which can be problematic. See also #87. There may be ways to neatly bundle the files that ace editor needs in one file. but I haven't yet succeeded in that. If you find a way to solve this please let me know! |
I've actually been able to get rid of every warning except the theme one by using Brace (https://github.com/thlorenz/brace), since I'm using browserify. Is there a way to change the theme in jsoneditor? Brace comes with multiple ones but jsoneditor always tries to load |
Ah, that's good to hear. Which warning is remaining exactly, and is that because of the current build of JSONEditor, or due to Ace itself? Time to have another look at brace (see also #64). Right now the code of JSONEditor is AMD (published as UMD), I choose that at that time partly to get experience with AMD, partly because Ace was using AMD, and partly because I didn't have a strong opinion on which module system to use. But right now JSONEditor is the only project I have left using AMD. In other projects I'm using CommonJS + Browserify/WebPack everywhere, with great satisfaction. Refactoring to CommonJS will not be that much work. |
That's my experience as well :-) Anyway this is the error, trying to find the theme-jsoneditor.js module/file:
Caused by this line I suppose: Line 1180 in 63e61dd
I believe that if there was a way to set the theme, perhaps in the constructor options, it would solve this. I have also tried to require |
Ok thanks for the feedback. Let's give that a try. When I load example 03_switch_mode and switch to mode "code", I don't see a network request to |
I did not, because I am packing all vendor dependencies into a single minified vendor.min.js and wanted to avoid loner scripts. Trying to include I also don't think jsoneditor is loading Ace in this case, I'm pretty sure Brace is overriding all usages of Ace, so the only leftover trace of Ace is the theme name which doesn't exist in Brace. If you look at Brace's usage example, you'll see that in my case Brace is dynamically looking for a theme named json-editor, which doesn't exist in Brace. This could be solved by 1) including json-editor in Brace, or 2) providing an override for setTheme('ace/theme/json-editor'), so we could use for example 'ace/theme/monokai', which does exist in Brace. |
Yes, but I meant just for testing if this works out. The |
I've reworked the source code from AMD to CommonJS modules and now use @andrewboni and @nfvs can you maybe give the jsoneditor in the develop branch a try? |
@josdejong 4.0.0 is not working for me. The index.js file is using
|
The solution to this would be to include |
Ah good point! Will fix it, thanks. For now I guess you could load the editor via |
I think It's not a browserified package though, so I believe there should be another build output |
|
@nfvs I've just released jsoneditor v4.1.2, which includes the |
Hi, as part of my build process, I'm concatenating all of my js files into a single file, which ends up living outside of my
/public/bower_components/
dir, wherejsoneditor
and other js libraries live.As a result, the theme and formatting files are 404ing:
Is there a way to explicitly specify the path to
mode-json.js
andtheme-jsoneditor.js
? Or canjsoneditor.min.js
include these files automatically? What's the best way to handle this? Thanks!The text was updated successfully, but these errors were encountered: