Install:
%USERPROFILE%\Documents
to open Documents- Open
Visual Studio 20XX
folder - Open
Templates
folder - Open
ItemTemplates
folder - Open
TypeScript
folder - Download each of these files into the TypeScript folder
Usage:
- Right-click on your
components
folder (or whatever folder you want to put your new component into) - Hover over
Add >
option - Choose
New item... Ctrl+Shift+A
option - Seek for
StencilJS Component
(probably is the first item available, if you're in a ASP.net Core C# Project) - Give the name you want for your component (it must have a
-
in it). Ex.:my-component
- Open
my-component.ts
, and find theexport class my_component
- Click on
my_component
and use Rename in it ([F2] or right-click,Rename...
option) - Overwrite
my_component
toMyComponent
and press [Enter] (or [Apply] on the rename mini-window)
A folder called my-component
will be created with these files inside it:
my-component.scss
: main SASS style for the component (imported through files 2 and 3)my-component.ios.scss
: SASS file used only for iOS platformmy-component.md.scss
: SASS file used for all platforms, except iOS (material design)my-component.ts
: Your view model file (no TSX allowed here, only Props, State, etc. methods available for the view must be public, otherwise, private or protected are fine)my-component.view.tsx
: Your view (it will import and use your viewModel)my-component.models.ts
: An empty file for your models (it will importType
fromclass-transform/decorators
, see https://github.com/typestack/class-transformer)