Skip to main content

Getting started with Blockly

2. Setup

Download the sample code

You can get the sample code for this code by either downloading the zip here:

Download zip

or by cloning this git repo:

git clone https://github.com/RaspberryPiFoundation/blockly.git

If you downloaded the source as a zip, unpacking it should give you a root folder named blockly-main.

The relevant files are in docs/docs/codelabs/getting-started. There are two versions of the app:

  • starter-code/: The starter code that you'll build upon in this codelab.
  • complete-code/: The code after completing the codelab, in case you get lost or want to compare to your version.

Each folder contains:

  • scripts/
    • main.js - The main logic for the app. In the starter project it has all the code needed to navigate and switch between views in the basic app.
    • music_maker.js - A small library to play sounds. We will use it to actually play sounds in the browser.
  • sounds/ - Sound files for various notes
  • styles/ - The app's CSS
  • index.html - The app's index page.