Background
While we’ve made progress in other areas, feature development on https://snowdrift.coop itself has been stagnant since late 2016, when we ran out of funding for @chreekat to work on it full-time. Instead, it continued on a prototype, which was easier (read: possible) for our designers to work with. This avoided one roadblock but created another: the prototype rapidly became out of sync with the live site, making it harder to integrate any improvements.
A month ago, I decided to take on the challenge of repairing our development pipeline. First, I had to understand the problems with the current state. The very short version is:
-
The main issue with frontend development is long compile times. When your reference is a mockup, frontend work involves a lot of visually checking to make sure that things look right. Waiting 10 to 60 (!) seconds to see the result of a property change is not workable.
-
A secondary issue is lack of Haskell devs to support frontend folks who may not have experience in Haskell.
-
A minor issue is that, from a prior attempt to bring the production site up to date with the prototype, there are a mix of styles in production.
Second, I had to come up with a plan[1]…
Goals and non-goals
-
We don’t want to throw away the work on the prototype, so we need a process for porting that work back to the production site.
- We would like to avoid making the mix of styles on the production site too incoherent during this transition process.
-
Once the production site is up to date with the prototype, we need a workflow for frontend development that makes it all the way to in production, so we don’t get stuck, unable to update the live site, again.
- We don’t need this workflow to be perfect, or even very good. It just needs to be good enough that we’ll actually use it, and can iterate from there.
Plan
Long compile times affect building new pages and making any modifications larger than phrasing tweaks, but should not affect importing a new page from the prototype by copying it wholesale:
- Both sites use sass, so it can be copied verbatim.
- The prototype (a static site generated with piecrust) uses html with jinja templating, while the live site uses yesod’s hamlet. Html can be automatically converted to hamlet, but the splices will need to be done by hand.
That’s some work, but not too much. Most importantly, because the sass is identical, the site should look right the first time it compiles; it’s not the ideal workflow, but hopefully it’ll be good enough to satisfy the goals.
Note: The sass is split between styles for individual pages and shared styles (“main”), which are included on each page via sass imports. In the production site, these shared styles live in the same directory as the page templates (navbar, footer, etc); we’ve been calling this combination a “skin” for the site.
There are currently two skins,
main-v1
andmain-v2
.
So
- Update the prototype to be production-quality.
- It was built by the volunteers who had time on their hands, not necessarily coding expertise. As a result, it is functional, but not particularly maintainable.
- I don’t want to spend effort porting the prototype work to production, when I know it’ll have to be re-done shortly after.
- This mostly involves reducing the amount of margins + padding to position individual elements, which create non-obvious couplings and make layout adjustments very time-consuming.
- Import the prototype pages that are ready to production.
- Create a new skin on the production site, imported from the current prototype. ex:
main-v3
. - For each page to be updated, replace the current production version (hamlet and sass) with the version from the prototype.
- Note: The sass
@import
paths will need to be updated tomain-v3
instead ofmain
, as they are called on the prototype.
- Note: The sass
- For each other page, swap it to use the new skin’s templates. This way, all pages will have a consistent header, footer, and metadata (the latest version), even if the content itself has a mix of styles.
- Create a new skin on the production site, imported from the current prototype. ex:
- To make changes in the future, update the relevant page in the prototype, then import it to production using the same process.
- The downside of this approach is that it will involve repeatedly converting more-or-less the same html to hamlet; the viability of this plan rests on the assumption of a fairly painless conversion process (or at least, less painful than the current workflow).
- Remove old skins from production once there are no longer any pages using them.
When all pages in production are up to date with their prototype equivalents (which implies only one skin left), then the plan is complete, and it’s time to start working on improvements to the main site’s frontend workflow, so we can remove the crutch of the prototype and develop on the production code base directly.