I am fascinated by the thought which device you might be using right now to read this article!! A laptop, a desktop or swiping your fingers across a smartphone or tablet? When you are surrounded by the incredible plethora of devices responsive design comes as a dire necessity. So when it’s a dire need how can Salesforce be a step behind, it introduces lightning components a brilliant UI framework for developing dynamic web apps for the cell in our pockets and desktop devices. An excellent stuff for building single- page applications engineered for growth.
But changes are difficult to adopt, so it has been a constant effort by Salesforce to develop new features and functionalities to reduce the efforts and enhance the ease of adding responsive components with every release.
Adding Components To Apps
Earlier adding components to your app involved that once you are ready with the creation of components and prepared to add the components to your app you have to look for the out-of-box components that come along with the framework. You can easily leverage these available components by using them or extending them to add them to the custom components you are building.
See the Components folder at https://<myDomain>.lightning.force.com/auradocs/reference.app, as in is the name of your custom Salesforce domain. The UI namespace includes many components that are common on Web pages.
The components are encapsulated such that their internal structure remains private on the contrary their public face is visible to the consumer of the components. This clear boundary gives the author of the component flexibility to change the internal implementation and insulates the consumers from the changes implemented. However, the public shape of the component is defined by the attributes that can be configured and the events that can interact with the component.
(To build a new component we should always focus on the attributes that we want to display and the events that should trigger the components). Once you have completed defining the shape of a new component, developers can proceed on the components in parallel. This is a highly productive approach if you have a team working on an app.
Adding Lightning Components to Any App with Lightning Out (Beta)
To ease your job of adding lighting components to any app Salesforce comes up with Lightning Out (beta). You can use Lightning Out to run Lightning components apps outside of Salesforce servers.
“Whether it’s a Node.js app running on Heroku, a department server inside the firewall, or even SharePoint, build your custom app with Force.com and run it wherever your users are.”
To simplify things there were no major changes induced between deploying the lightning components anywhere and doing the same within Salesforce. All the things that you are already aware of about lightning component development still hold true. The main difference lies in the process, more specifically, in processes related to embedding the lightning components app in the remote web server or the origin server.
This approach adopted is quite different from that of embedding an app using an iframe. The Lightning components are treated as full citizens on the page when dealt via Lightning Out. You also have the choice to enable interaction between your Lightning components app and the embedded app and this interaction is managed by using Lightning events.
Apart from certain straightforward markup, there is a decent amount of setup and preparation needed within Salesforce to enable a secure connection between Salesforce and the origin server. Since the app is hosted in the origin server you have to handle the authentication with your own set of codes.
While wrapping up I would like to say since most of your components are running “outside” of Salesforce, so there will be certain issues that you should not be oblivious about. And it is very much possible there are changes you might need to make to your components or your app. There are two categories of concern:
- Considerations for Using Lightning Out-
The most obvious issue is authentication. There is no Salesforce container to handle authentication for you, so it is entirely your concern to take care of the authentication aspect. To learn more click here.
- Limitations During the Lightning Out Beta-
The core Lightning Out functionality is stable but there are a few interactions with other Salesforce features that it is still improving on.
Lightning Out is the technology that fuels the Lightning Components for Visualforce, which is now accessible in the “full strength” version. The process for using Lightning Out is relatively simple. It involves preparation, creating a reference to a Lightning Components app that has all the dependency information about the components and lastly creating components on the page to build the page’s functionality. So go ahead and explore the new Lightning Out and share with us your valuable experience.
Dont miss to check out : Real Time Access To External Data Using Salesforce Lightning Connect
References: developer.salesforce.com, releasenotes.docs.salesforce.com