Yes! that’s right. It’s a beautiful gift from Salesforce, giving us (developers) the ability to code in both Lightning Experience and Classic without having to struggle with the different 3rd party styles sheets to match with the Salesforce Lightning Experience UI.
It has always been a big hesitation for many of the Salesforce Developers, to convert the existing VF pages to Lightning Experience UI. Developers were often pushed (unwillingly) to convince our customers to use the same theme as in classic and to just bring in the VF pages to Lighting Experience as it is, with very minor style changes. Reason behind this is that developer is often pushed towards taking up an additional UI designer role to his/her development of the core business process in Apex/Visualforce.
In Winter’18 Salesforce has introduced a new attribute for the Visualforce pages in Salesforce. “LightningStylesheet” is the Magic Word. All you need to do is add this as an attribute to the existing Visualforce pages <apex: page> tag and….. BOOM! Your Visualforce page turns into a Lightning page. How simple is that? Now the Salesforce Developer can concentrate on the business process logic in the Apex and Visualforce without wasting time in UI/UX designing. The UI theme/styles part is taken care of automatically.
So let’s see how this works in a real-world example. Let’s consider a simple contact form where we have coded the page to capture the First Name, Last Name, Phone, and email of a person. Let’s see how it works when we flip the LightningStylesheet flag ON and OFF. (Below image is a 30sec GIF image. If not loaded Please Click Here)
YES! It happened just like that!!!
So this is again another sign we should start moving towards Lightning Experience. Now it’s more smooth and easy to adopt for both Developers and Customers. What else we need from Salesforce as a Christmas’17 Gift to our hard working Salesforce Developers Community.