January 25, 2017 by LanceShi
1.0 Setting up the environment
Before we do any development work for lightning components, there are several things we need to setup first.
Add a Custom Domain to Your org with My Domain
To use Lightning Components, your organization needs to have a custom domain configured using My Domain.
So what the heck is a custom domain, and why do you need to have one to use Lightning Components? First of all, a custom domain is a way to have your very own Salesforce server…sort of. It’s a way for you to use Salesforce from your own, customized URL, rather than a generic Salesforce instance URL. That is, once you have a custom domain, you’ll use Salesforce at https://yourDomain.my.salesforce.com/, which is reserved exclusively for your org’s use. Let other folks continue to use and share https://login.salesforce.com/. Your custom domain puts you on your own private Internet island.
The above description is from Salesforce trailhead. Generally speaking, having a custom domain is very coooooooool and it is essential to have one before you can actually write lightning component code.
So below is the guide to add your custom domain with my domain:
- From Setup, enter My Domain in the Quick Find box, then select My Domain.
- Enter the name for your subdomain after https:// and click Check Availability. Typically, a subdomain is your company name, but you can use any name as long as it’s unique. If this name is already taken, choose another one.
- Click Register Domain.
It take some time for Salesforce to accept your domain registration. Once it is accepted, you will get an email with an subject like: “Your Developer Edition domain ready for testing.”
Once you received that email, you can follow these steps to roll out your domain to your org:
- Click the link in the activation email to log in to your Salesforce subdomain. It takes you to your Salesforce org.
Notice that the URL in the browser address bar shows your new subdomain name. Right now, you’re the only one who has this URL.
- Click around your org to make sure that links point to your new domain. You probably haven’t created links in your DE org, so we can go on. (When creating a domain in a production org, this important step is easily overlooked.)
- Click Deploy to Users, and then click OK. Deploying a subdomain rolls out the new subdomain URL throughout your org. Now all your users see the subdomain URL in the browser address bar.
- Click OK.
- Step 4 of the wizard displays configuration options, which we can ignore for now.
After you finished all these, you have successfully deployed your domain to your org. And now your org is ready for lightning component development!
Setup the IDE environment
Once you have set up your org’s domain, the next step is to find out where to write your code.
Salesforce has recommended using Developer console. Well, it is convenient, and it is pretty handy for lightning component development as well. It depends on you whether you want to use it or not.
If you don’t like developer console. Good, me neither. Personally, I have used a sublime plugin called HaoIDE. You can feel free to use Mavensmate or Force.IDE for eclipse. All of them support lightning component development very well. For introduction about the IDEs, refer to my post here. Pick up anything you like and you are ready for lightning component development.