Nunjucks adventure (Release 2 for OSD)


At the start of this release 2 assignment, I told myself I’m gonna try something with javascript I didn’t want to do another CSS fix. So trying to do something more challenging I came across a bug that made developers working on the front end be forced to reload the server, to notice their HTML changes. I was really curious about this mainly because I’ve never heard of this type of problem. After reading the bug issue and the information that my professor wrote, I felt like this was a new challenge that I could complete. At first, it starts off fine. Reading the API docs and looking what other developers that had this problem had to say.


After reading the docs and learning as much as I could about nunjucks I decided it was time to tackle this. I first tried to recreate the Issue, so that I can compare the difference to confirm that my code was actually changing something. I noted down the information that I collected from the recreate and then started to work on the code. I thought since I learned so much about nunjucks that I knew exactly how to fix this.


So I wrote my code, restarted the server and started testing. Well then to my surprise it, didn’t work and I was in shock. I started to question everything about what I wrote and started to get frustrated. I kept telling myself, I must’ve done something wrong because everyone said this is how to fix it. Kinda felt like a detective reading the code character by character and comparing to other people’s fixes. But they were almost identical, and now I was afraid that maybe I couldn’t fix this. So I decided after of a week looking for why this didn’t work and a deadline coming up I should make a pull request and see what other people say. So I made my request and waited, nervously waiting for someone to say “Oh this is an easy fix” or someone says “Ok, your not crazy there’s another part of the project that is fighting you”.  So then one of the first suggestion came in, and it was cleaning up the code to reduce the length of the line, which I did and told myself “Ok, so maybe I did it correctly?”. Then Luke mention that it was taking a long time for the page to reload, and then I knew the moment of truth will come soon.  Then my Prof David Humphrey came in and saved the day, he knew exactly what was happening and in 10 minutes he fixed something that I tried to do in a week. Then everything was fine, updated my pull request and now I’m just waiting for to be approved.

Here is the code I had to work with:

let engine = new Nunjucks.Environment( => new Nunjucks.FileSystemLoader(path)), { autoescape: true });

And changed it to:

let nunjucksOptions = {
noCache: true,
watch: true,
autoescape: true

let engine = new Nunjucks.Environment( => new Nunjucks.FileSystemLoader(path, nunjucksOptions)));

Overall I’m glad for this experience, it had a lot of up and downs and I feel like I improved as a programmer. I learned the importance of documentation and communication with other developers.  I also embarrassed myself a little on the issue, by testing the wrong thing, and that made me afraid to talk for a whole week, but I told myself I’m not the first person to make a mistake like this and I won’t be the last. So I decided to get over it and try to finish this bug. I’m now looking forward to trying a bigger bug for release 3, now that I’m more confident with the open source world.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s