generator-svalter

Generator to help you create and manage svelte/sapper application


Keywords
Svelte, Sapper, Generator, Component, Web, yeoman-generator, yeoman
License
Apache-2.0
Install
npm install generator-svalter@1.2.0

Documentation

generator-svalter NPM version Build Status Dependency Status

Generator to help you create and manage svelte/sapper application

Features

  • Generate a boilerplate project for svelte, sapper or a component library
  • Generate routes (sapper only), components, models, services and (svelte) actions

Supported "templates"

  • Svelte : (javascript || typescript) && (css || scss)
  • Sapper : (javascript || typescript) && (css || scss)
  • Component library : (javascript || typescript) && (css || scss)

Installation

First, install Yeoman and generator-svalter using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-svalter

Usage notes :

Each option is optional. If the generator needs more data, you will be prompted a question.

Project generation

mkdir your-project
cd your-project
yo svalter [project_name] [options...]

svalter-gif

Available options

Option Description
--svelte Creates a svelte project. (Skips the project type question)
--sapper Creates a sapper project. (Skips the project type question)
--library Creates a component library project (Skips the project type question)
--css-reset=<name> Adds a css reset in your project. name can be any of : none, meyer_reset, normalize, sanitize (Skips the css reset question)
--style-separation Components' styles will be put in a different file for each component
--no-style-separation Components' styles will be put in the same file as the markup
--script-separation Components' scripts will be put in a different file for each component
--no-script-separation Components' scripts will be put in the same file as the markup
--typescript or --ts Adds TypeScript support to your project
--no-typescript or --no-ts Does not add TypeScript support to your project
--sass or --scss Adds SASS support to your project
--no-sass or --no-scss Does not add SASS support to your project

Component generation

#in a svalter project
yo svalter:component [component-name] [options...]

Available options

Option Description
--folder=path Put the component in a specific folder (which will be under /src/components)

Route generation

#in a svalter project
yo svalter:route [route] [options...]

If your route's name starts with [ and ends with ], you will be prompted to choose a predefined pattern to help you.
If you have existing routes containing path variables with patterns, you can skip the pattern, and the generator will still find the right route for you.
Example:
If a route "/a/[b(some-pattern)]/" exists, to generate a new [c] route, you can type :

yo svalter:route a/[b]/[c]

Available options

Option Description
--json-api or --api Create a json api script in this generated route
--page-component or --page Create a page component in this generated route
--page-layout or --layout Create a page layout in this route
--pattern=some_pattern Available patterns: none, numbers, characters, uuid, date, time, datetime. Many patterns can be specified (separated by ; ) for each path variable that doesn't currently exist

Service generation

#in a svalter project
yo svalter:service [service-name] [options...]

Available options

Option Description
--folder=path Put the service in a specific folder (which will be under /src/scripts/services)

Model generation

#in a svalter project
yo svalter:model [model-name] [options...]

Available options

Option Description
--folder=path Put the model in a specific folder (which will be under /src/scripts/models)

Action generation

#in a svalter project
yo svalter:action [action-name] [options...]

Available options

Option Description
--folder=path Put the action in a specific folder (which will be under /src/scripts/actions)

Considered features

Recipes generation
i18n addition

License

Apache-2.0 © Nokorbis