Github Repos as a Template System

AdnanUncategorizedLeave a Comment


Open Source projects don’t cease to facinat me, and especially JavaScript ones. I have just finished building a cool Open Source project I called Boxed that would turn any Github repository into a Template System. This can be very useful and time saving tool for many software projects. During making the tool I discovered few awesome project which I wanted to share with you, for example zip.js, to compress/uncompress files on the client-wsie, github, to manipulate github repos in JavaScript and alpaca, to generate forms on the fly.

Here’s how the story began!! Last week I was playing with the new, awesome and shiny platform PyroCMS 3, creating a Custom Module for an application I am builing, iBuild. I managed to locate a Github repo that provides a boilerplate code ,Example Module that I downloaded and started to customize. I had to do many changes, .. alter details in composer.js, change file names, folder names, namespaces and many other details of the module. That took me over an hour, .. Like many of you, I thought, this is not acceptable and something has to change.

I am a visual person, and the last thing I had in mind to solve this problem was to build a command-line extension to Laravel Artisan that would scaffold the Module for me. Instead, I built a visual tool, Boxed!

Boxed provides developers with the facilities to distribute a customizable package or addon directly from a github repo. The only thing that is required is that, the developer will have to place template placeholders across the code which Boxed will locate and replace with the values the user enters when customizing a module/addon.

Boxed presents the user with an auto generated form for all the variables/placeholders specified by the developer (i.e. name, namespace, module name, email etc). Once the user finishes and is ready to generate the code, Box will download the repository to the browser, parse it using Handlebarsjs, compress/zip it and present the user with a download link.

I also included another example to this, where the user can customize a single page html template, the user will be able to enter the title of the page, generate and download.

The process for adding more modules/addons to Boxed is quite simple. All that’s needed is for the developer to fork Boxed, generate a specification json file of their repository and place in ‘repo’ folder. Also add a unique slug to repos.json file, and make a pull request. enjoy 🙂