LaceySnr.com - Salesforce Development Posts by Matt Lacey

Lightning Strikes! How To Bottle It

Posted: 2015-03-06

Chances are that if you've not been on a desert island for the whole of the last six months and you're involved with the Salesforce platform in any shape or form, you will have heard of Lightning. I finally built my first Lightning Component, and I've got to say it was quite fun (aside from an issues in my Firefox dev tools where I'd accidentally disabled Javascript error reporting!), and I think it's definitely going to change the way developers work on the platform, not least when it comes to mobile.

Where's The Lightning Framework Used?

Right now you can build Lightning Apps and Lightning Component Bundles, and you can then host those apps inside of the Salesforce1 mobile application using a custom tab. Later on we should see this apps hosted inside of the desktop browser version of Salesforce too.

What's Involved?

Lightning components use a new markup library that's not too dissimilar to Visualforce, instead of <apex:inputDate> there's <ui:inputDate> for example, but the biggest change is that Lightning components make extensive use of Javascript—there are Javascript controllers which deal with most of the logic.

It's a client-side framework which is what makes it suitable for mobile applications, it's much, much, faster than making round-trips to a server with a viewstate as baggage, only the data that needs to go back and forth does so.  Lightning component bundles can also include CSS which is namespaced accordingly, and can even contain other components, making it easy to keep things modular.

Getting Started

Now on to the real reason for this post, and that is to collate some resources that should help you get started on your lighting journey.

1. Lightning Week - March 2015

First of all, Lightning Week is coming up! This is a great opportunity for you to get hands-on experience, so check out the site to see what's happening in a city near to you.


I love this little racer!

2. Trailhead!

Next up, the ever-awesome Trailhead now has a Lightning module which should definitely be something you partake in if you want to get up and running quickly.

3. Lightning Component Developer's Guide

Documentation should always be something you look into, and this developer guide is no exception. It was my main source of information while writing my first component, and includes an in-depth introduction chapter which involved building out a basic, but complete, app.

4. Code Coverage

Yes, I'm biased, but we just had @PeterKnolle on Code Coverage talking specifically about Lightning Components and how they're built. If you want to get a head start while on your commute in the morning you really should check this episode out. Peter has also written a great blog post on Lightning Component Inheritance if you really want to sink your teeth into some more advanced topics.

Related Posts