This post is part of a series
- Node allows us to embrace js modularity - the organization of js into neat modules which are autonomous, extendable, and testable. The notion of Modules has been added to the latest spec, so this is trully how js code should be organized. Please kill that monolithic file that has all the front-end code for the entire site and create a js library that’s as beautifully architected as your .NET application, and as easy to traverse as your Sitecore tree.
- Adding node allows us to easily utilize popular frameworks like React and Angular in our Sitecore components.
- Node makes it easy to add transpilation to our build process, so we can get fancy with TypeScript or ECMAScript 6 code.
- By setting up a node stack, we create a way to manage front-end code that’s independent from both, Sitecore and Visual Studio. This makes js development MUCH faster. It also frees you from having to develop in a Windows enrivonment.
There is a very large number of libraries to chose from when determining your Node stack. In fact, the number of choices feels overwhelming to a newbie (this is another reason people are afraid to get their feat wet). My advice is this - don’t get hung up on chosing the perfect set of tools, and start with the minimum toolset necessary to accomplish your immediate needs. You can always add on to the stack later. Remember that all the competing libraries (gulp vs grunt, npm vs yarn, webpack vs Babel) are server side tools; this means it’s ok to experiment and make mistakes. The worst that can happen is you make a selection that’s not optimal in terms of configuration effort and build time, but it will still get you the same end-result and the frontend won’t blow up.
That’s it for my pep-talk. In the next post I will demonstrate how easy it is to achieve what I described above.
You Don’t Know JS: ES6 & Beyond by Kyle Simpson - this is a great teacher of all the fancy new stuff in the latest spec. Understading how the new features work does not come naturally from simply looking at the code. So everyone just has to buckle down and study these. Then force yourself to use them in your code to make sure the lessons stick.