google / blockly-games

Games for tomorrow's programmers.
https://blockly.games/
Apache License 2.0
1.28k stars 603 forks source link

How can i get code without build? #223

Closed Teeratat9 closed 3 years ago

Teeratat9 commented 3 years ago

It hard for me for edit a little thing on blockly game code

cpcallen commented 3 years ago

Hi Teeratat,

You can get the Blockly Games code using the green "↓Code" button on the Blockly Games repo homepage. (You'll need to have git and/or a GitHub client installed.)

After that you don't need to build—just point your browser at the file blockly-games/appengine/index.html and away you go.

jk987 commented 1 year ago

@cpcallen: I'm afraid it doesn't work this way. (I downloaded the zip file with code and unzipped it into c:\blockly-games-master) It seems like there is hardcoded some link to "generated" files. Am I doing something wrong?

image

NeilFraser commented 1 year ago

I don't think @cpcallen got this one right. There are two approaches:

  1. If you want to run Blockly Games locally, and don't want to make any modifications, then download the offline versions. Everything is right there. https://github.com/google/blockly-games/wiki/Offline But this pre-compiled version cannot be edited.
  2. If you want to run Blockly Games locally, and you do want to make any modifications, then download the sources as described above. Then visit blockly-games/appengine/admin.html and choose "Debug mode". Then you can go to index.html and play. Edits to the src files will work fine. But this doesn't work well over the Internet, since debug mode doesn't build/compress the files, meaning the load times will be very large.
jk987 commented 1 year ago

Thank you for your help, but I think there is still some misunderstanding. I'm trying the option 2 (to be able to make modifications). In offline version there is no admin.html. In github sources there it is, so I can switch to debug mode (which I can see in console "Uncompressed mode activated. Happy hacking!") but when I go to index.html then I get very similar errors.

image

I feel the problem is somewhere in boot.js around here:

  // Load the chosen language pack.
  var script = document.createElement('script');
  if (debug) {
    script.src = 'generated/msg/' + lang + '.js';
  } else {
    script.src = appName + '/generated/msg/' + lang + '.js';
  }
  script.type = 'text/javascript';
  document.head.appendChild(script);
  // Load the code bundle for the chosen game.
  var script = document.createElement('script');
  if (debug) {
    script.src = appName + '/generated/uncompressed.js';
  } else {
    script.src = appName + '/generated/compressed.js';
  }
  script.type = 'text/javascript';
  document.head.appendChild(script);

There is nothing like generated or msg or uncompresed in the repository. Seems like I still have to build it at least once. (?) (I hoped to avoid getting python or java just for making javascript from javascript.)