Skip to content

Creating a new basic component

Joseli.to edited this page Oct 3, 2018 · 4 revisions

Every basic component from sling has the prefix sling-web. You should create a folder inside of the packages folder, containing the following files:

sling-web-framework/
	├── packages/
	│     └── sling-web-component-my-new-component
	│	  ├── src/
	│	  │   ├── assets/
	│	  │   │    ├── MyNewComponent.css
	│	  │   │    └── host.css
	│	  │   ├── component/
	│	  │   │	   ├── MyNewComponent.js
	│	  │   │	   └── MyNewComponent.test.js
	│	  │   ├── index.js
	│	  │   └── index.css
	│	  ├── public/
        │         │   ├── index.html
	│	  │   ├── index.js
	│	  │   └── index.css
	│	  ├── .npmignore
	│	  ├── README.md
	│	  └── package.json

For now, you can copy the structure from a folder that already exists, while we don't have a command-line interface to help you out. You can also download the files from stone-payments/sling-web-component-starter repository.

You can start this new component with npm start my-new-component and see it in your browser.

Clone this wiki locally