In the last post I mentioned I wanted to dive a little bit into using Backbone and Underscore for a theme. I still am pursuing that. I’ve made some progress on that front so that’s a good thing.
There is one thing that does need to change a little bit. The libraries used in core. Currently they are at version 1.2.3 and 1.8.3 for Backbone and Underscore respectively. Core is a little outdated and is in need of an update. Yes, there is a core ticket for backbone and underscore on trac but they do need testing.
That’s great!
Now this means I get to set up my test site and try to break things. I’m really looking forward to this part. Yes, I like to figure out where things break and why a lot.
The other reason I’m happy is because earlier today I realized that I didn’t have the WP-API plugin on this site. I know, I know. Core will be using this down the road but this is one thing that really needed to be installed on here for the longest time. I don’t really know how I never installed it long ago but that is now fixed.
I guess the next stage will be in writing out a quick post on my learning of underscore and templating. I did learn a few things while diving into the core files and undercores documentation.
The big lesson learned was that the following code is used in core and can be used in a theme in order to declare your own version of templating rather than having to add wp-util
as a dependency.
_.templateSettings = { evaluate: /<#([\s\S]+?)#>/g, interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, escape: /\{\{([^\}]+?)\}\}(?!\})/g, variable: 'data' };