Creating Lightning Components: The Bundle as Scaffolding
Don Robins continues the series on creating Creating Lightning Components (2 of 6), discussing how the component bundle provides the scaffolding to manage component resources as meta data.
This series introduces you to the Lightning Component Framework through a free online course by Salesforce University combined with a six part blog series written by Don Robins, a Salesforce MVP, Certified Advanced Developer and Certified Salesforce Instructor. Each post provides deeper insight and additional perspective around topics covered by each course module.
Components are Application Building Blocks
Remember, a component is nothing more than a building block that can encapsulate both presentation and/or logic. The component can be very simple, very complex, or somewhere in the middle. A given component can contain one or more components, or it can be contained by one or more components. Its job is simply to provide a specific piece of functionality in any given application.
Resources are Component Building Blocks
In Module 2: Component Markup and Style, we’ll take a closer look at just a few of the various supporting resources that can be encapsulated and contained in a component. Taken together, we refer to this collection of metadata resources as the component bundle. As we do this, we’ll walk through adding some markup and CSS style rules in the resources to make our simple component a bit prettier.
Markup in the Component resource is used to shape the visual presentation of any Lightning Component. If you’re familiar with Visualforce, you’ll feel right at home with component markup. Although they have different names and namespaces than those you’ve used in Visualforce, most Lightning Component tags and their named attributes have the same usage pattern. These tags can also use CSS classes from linked stylesheets just like Visualforce markup, but what’s a little different here is that a special Style resource also allows CSS rules to be completely encapsulated within any component.
Such encapsulated style rules are usually accessed only by the markup in the Component resource of the component bundle, and would typically not be used by any other component. The benefit of encapsulated style is that it allows everything a component requires to be contained in one neat deployable package. However, developers don’t have to encapsulate CSS. They may still leverage style libraries like Twitter Bootstrap or others.
The Component Bundle Provides the Scaffolding
Let’s Dig Back In
Watch Module 2: Component Markup and Style to learn how to use bundled resources. Using the Developer Console, you’ll get your feet wet learning about adding markup and style to your components.
Creating Lightning Components online course
Creating Lightning Components: Single Page Applications (1 of 6)
Creating Lightning Components: The Bundle as Scaffolding (2 of 6)
Creating Lightning Components: Action Processing and Binding Data (3 of 6)
Creating Lightning Components: Component Based Architecture (4 of 6)
Creating Lightning Components: Events and Messaging (5 of 6)
Creating Lightning Components: Wrapping It Up (6 of 6)
About the Author
Don Robins is a Force.com MVP, Certified Advanced Developer and award winning Salesforce University Certified Instructor. Since 2010, he’s been delivering the core development curriculum to hundreds of customers in both public and private workshops for Salesforce University in the US and abroad. As an independent Training Delivery Partner through his company Forcementor.com, he leads and mentors a team of certified Salesforce instructors, curriculum developers and technical authors. He found his way onto the platform as a consultant and developer in 2009, after two decades of building custom business applications with a metadata, framework-based approach. Ever since, his primary focus has been to educate developers and the business community on Salesforce1 and to evangelize the platform.