Before you write code for your users on mobile devices, configure your environment and use built-in mobile-ready tools and features.
To develop Lightning web components that are optimized for mobile, follow these prerequisites and processes.
-
Set up your development environment
We recommend setting up the VS Code editor and the Salesforce DX tools for an end-to-end development experience. You’ll also want to set up a local development server and other tools that can help with mobile development.
-
Install the mobile extensions plug-in for VS Code
Inspect and preview your components on virtual mobile devices before you deploy them to mobile users.
-
Install SLDS Linter
SLDS Linter is the latest code analysis tool that helps to prepare your components for use in SLDS 2. SLDS Linter analyzes your code against SLDS 2 rules. It offers suggestions on how to improve your code and make it more future-proof. SLDS Linter can also automatically fix your code and apply those suggestions in bulk across your repository.
After you create a Lightning web component:
-
Validate Your Base Component References
Base components help you develop apps quickly. However, not all base components are designed for mobile environments. SLDS Linter or SLDS Validator for VS Code can help you determine the mobile readiness of the base components you use.
-
Use Mobile Validation with Salesforce Lightning Design System
SLDS Linter and SLDS Validator check your code for SLDS mobile guidelines adherence as you type. If they find a potential issue, both tools provide a warning with suggested improvements. These warnings apply to HTML and CSS code. SLDS Linter also automatically fixes your code and applies those suggestions in bulk across your repository.