Closed ralphwetzel closed 10 months ago
@ralphwetzel,
This is VERY kind of you!! Thanks a lot for this. Your way to load this is very creative. I wouldn't have thought about that myself...
@cymplecy: I had installed the blockly-themes branch from Ralph's fork, and then e.g. the Black theme looks like this:
So I have merged his changes in our master branch.
Initially Bart tried to import the Blockly Theme modules the conventional way:
This yet runs into
Cannot read properties of undefined (reading 'Blockly')
. Looks like there's an issue with thewebpackUniversalModuleDefinition
implementation. I found no way to compensate for this. Bad. As[...]/src/index.js
is the pure code file (not being wrapped into thewebpackUniversalModuleDefinition
stuff), I tried to import from there. Fails as well, asimport Blockly from 'blockly/core'
cannot be resolved. The good thing: We don't need this import at all!Blockly
is guaranteed to be already defined! Fortunately, the Blockly Theme plugins follow a very simple & identical pattern - supporting the following hack:import Blockly from 'blockly/core';
from the script.export default ...
statement by a simplereturn
.Blockly.Themes
object.Works like a charm!
Closes #106