Skip to content

Generate

Alexander M edited this page Mar 1, 2018 · 1 revision

ig generate

Overview

ig generate template [name] generates a new custom template for supported frameworks and project types. In addition, by default the command registers the generated template path in the customTemplates in the global config of the Ignite UI CLI. That makes the generated template automatically visible under the Add View menu, or directly when using add command.

The command can generate custom template for jQuery, Angular or React.

To manually include the custom template in the CLI use the config add commnad to add a record in customTemplate.

Arguments

name

name (alias: -n) default value: "custom-template"

The name of the custom template. The template is generated inside a directory with the same name.

framework

--framework (alias: -f) default value: "jquery"

Framework to setup the template for. Your custom template will be available only when creating a project in the respective framework. The supported frameworks are jQuery, Angular and React.

type

--type (alias: -t) default value: "js"

The available project types depend on the framework we are creating a custom template for. Currently, when generating a custom template for Angular projects, you can select between `ig-ts` and `igx-ts` types (the latter for applications that are configured to use Ignite UI for Angular). jQuery and React projects support a single type only - `js` for jQuery and `es6` for React. As those are default project types, you do not need to provide `--type` argument when generating custom templates for jQuery or React projects.

skip-config

--skip-config (alias: -s) default value: false

Setting it to true will run generate command without updating the cli config.

Generating custom Ignite UI for JavaScript templates

To generate a template that will be available to use in your Ignite UI for JavaScript applications, you need to provide the desired framework you want to add the template for. Following are examples of how to use the generate command to generate a custom template in all supported frameworks:

Framework Code
jQuery ig generate template newjQueryTemplate
Using aliases: ig g t newjQueryTemplate
jQuery is the default choice so you do not need to provide the "framework" argument.
React ig generate template newReactTemplate --framework=react --type=es6
Using aliases: ig g t newjQueryTemplate -f=react -t=es6
Angular Wrappers ig generate template newAngularTemplate --framework=angular --type=ig-ts
Using aliases: ig g t newAngularTemplate -f=angular -t=ig-ts

Generating custom Ignite UI for Angular templates

To generate a custom template that will be available to use in your Ignite UI for Angular applications, you need to provide "igx-ts" as the type argument.

Framework Code
Angular ig generate template newAngularTemplate --framework=angular --type=igx-ts
Using aliases: ig g t newAngularTemplate -f=angular -t=igx-ts

Using skip-config flag

In case you want to generate a custom template but you don't want to register it into the Ignite UI CLI, you need to provide an additional skip-config argument set to true. Your command will look like this:
ig generate template newAngularTemplate --framework=angular --type=igx-ts --skip-config=true