2020-05-08 -> 2021-03-05
A tool to build svelte templates.
This is part of the universe framework.
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.
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.
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
1.1.4 -- 2021-05-31
1.1.3 -- 2021-03-05
1.1.2 -- 2020-12-08
1.1.1 -- 2020-12-04
1.1.0 -- 2020-05-11
1.0.0 -- 2020-05-08