SvelteTemplateBuilder

Sveltetemplatebuilder

A tool to build svelte templates.

SvelteTemplateBuilder

2020-05-08 -> 2021-03-05

A tool to build svelte templates.

This is part of the universe framework.

Install

Using the planet installer via light-cli

lt install Ling.SvelteTemplateBuilder

Using the uni command.

uni import Ling/SvelteTemplateBuilder

Or just download it and place it where you want otherwise.

Summary

Create a svelte component

To create a svelte component based on this template: my-svelte-component, we will use the script provided by this planet (referenced as /path/to/universe/Ling/SvelteTemplateBuilder/scripts/my-svelte-component.php).

This script requires two arguments: the component class name, and the component directory name.

Open a terminal and type this:

cd /myapp
php -f /path/to/universe/Ling/SvelteTemplateBuilder/scripts/my-svelte-component.php -- MyAwesomeComponent my-test-component  

This command will create the following structure:

- /myapp/
----- MyAwesomeComponent/
--------- .gitignore
--------- dist/
--------- index.html
--------- index-test.html
--------- package.json
--------- README.md
--------- rollup.config.js
--------- rollup.config-test.js
--------- src/
------------- main.js
------------- MyAwesomeComponent.svelte
------------- MyAwesomeComponentTest.svelte
------------- test.js

Then to use your component, type the following:

cd MyAwesomeComponent
npm install

And then either:

npm run dev

this will build the bundle file(s) and open the index.html page which displays your component.

or:

npm run dev-test

this will build the bundle file(s) and open the index-test.html page, which displays the Test version of your component. This command is good for testing/updating your component.

More info in the my-svelte-component page.

That's it.

Going further

As we saw, the path to the script is quite long and hardly memorizable by humans. Hence I recommend using a bash alias like this one for instance:

alias sveltecompo='php -f /path/to/universe/Ling/SvelteTemplateBuilder/scripts/my-svelte-component.php -- '

Now to create a svelte component, just do:

sveltecompo MyAwesomeComponent my-test-component 

History Log

  • 1.1.4 -- 2021-05-31

    • Removing trailing plus in lpi-deps file (to work with Light_PlanetInstaller:2.0.0 api
  • 1.1.3 -- 2021-03-05

    • update README.md, add install alternative
  • 1.1.2 -- 2020-12-08

    • Fix lpi-deps not using natsort.
  • 1.1.1 -- 2020-12-04

    • Add lpi-deps.byml file
  • 1.1.0 -- 2020-05-11

    • add test rig implementation, and fix using componentName instead of dirName
  • 1.0.0 -- 2020-05-08

    • initial commit

Top categories

Loading Svelte Themes