Learning Bridgetown, Part 2

You can start a web application with one file (like config.ru for Roda) and build from there. If instead you use a framework like Bridgetown (or Sinatra, Rails, Cuba, etc.), you will be provided with a “scaffold” of initial files and folders, setting up a standard organization for your project. This is very useful, but can also confuse beginning developers, as it mixes the various building blocks of the framework in a manner that is conventional and convenient if you know what each part is for.

view of the Bridgetown scaffold

Some of this information comes from general programming knowledge (about Ruby, JavaScript, etc.), something that everyone possesses in different amounts at different times. Other Bridgetown specific information can be found in the official documentation. Yet when I first started with Bridgetown, I wished I could have found a quick summary of the building blocks and scaffold that I was beginning to work with.

This is my attempt at making one.

The building blocks

Backend / Core:

Templating:

Frontend Bundling:

Package Management:

Content:

The scaffold

When you create a new project with the bridgetown new command, this initial scaffold of files and folders is provided. Here is a short description of what each does or contains. (Hint: to start a simple blog, for instance, you’ll only need to add content in the src folder.)

Folders:

Files:

The src folder

src folder in scaffold

As noted above, a beginning developer just starting a new site or blog with Bridgetown needs only concern oneself with the src folder, where the content lives. Yet opening this folder can also be disconcerting, initially. Here is a quick description (Hint: initially, you will want to modify the site_metadata.yml file in the data folder, and add your blog posts in the posts folder. For other types of content, you will need to look in more details at “collections”.):

Folders:

Files:

Conclusion

I hope that this helps you get started. Eventually, you will have to read more and more of the Bridgetown documentation (I am not finished with it yet!) In the meantime, please feel free to reach out if you find anything wrong or unclear in the above primer.