This project is an example of how to integrate Salesforce Lightning Design System (SLDS) within an Angular single page application.
It was generated with Angular CLI version 6.1.2 and is currently running on version 8.2. If suitable for you, you can install Angular CLI globally:
$ npm install -g @angular/cli
To explore this demo, Node.js must be installed into your Operating System.
- Open your Terminal
- Clone this repository with
git clone https://github.com/matteopio-napolitano/ng-slds.git
- Move to project folder
cd ng-slds
- Install dependecies with
npm install
- Run the app
npm start
- Navigate to
http://localhost:8080/
. The app will automatically reload if you change any of the source files.
Salesforce Lightning Design System (SLDS) can be integrated within an Angular CLI Application by loading all the necessary assets. To achieve this, it is necessary to configure properly the angular.json
file.
First of all, we need to add SDLS as a dependency:
$ npm install @salesforce-ux/design-system --save
Next step, we configure Angular by linking the CSS style sheet:
"styles": [
...,
...,
"node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css"
]
Finally, we link all SLDS's static assets:
"assets": [
...,
...,
{ "glob": "**/*", "input": "./node_modules/@salesforce-ux/design-system/assets/fonts", "output": "/assets/fonts/" },
{ "glob": "**/*", "input": "./node_modules/@salesforce-ux/design-system/assets/icons", "output": "/assets/icons/" },
{ "glob": "**/*", "input": "./node_modules/@salesforce-ux/design-system/assets/images", "output": "/assets/images/" }
],
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
All product names, logos, and brands are property of their respective owners. All company, product and service names used in this repository are for identification purposes only.
- Source code is licensed under MIT License
- SLDS licenses are available here
- Angular license is available here
Please open a new GitHub Issue.