Editor

Template editor to create and edit templates.

Create a template

  1. Select project from top left dropdown.

  2. Create a new template in a template group from 'Add new template' button. create new template

  3. Select template type. (Add, Modify)

Template types

  • Add: Add a new file to the project.
  • Modify: Modify an existing file in the project.
  • When you select modify, there will be a identifier field.
    • Identifier can be a comment in your file.
    • Example: // Add a routes here
    • Derived will find comment in your file and add the template code above the identifier.

Example modify case

  • Existing file: routes.ts
// rest of the code

// Add a routes here <----- identifier


// rest of the code
  • Template: identifier: // Add a routes here
import { {{.schema.name}}Routes } from "../{{.schema.name}}"
// Add a routes here
  • Result:
// rest of the code


import { userRoutes } from "../user"
// Add a routes here

// rest of the code

Live Preview

You can preview the template output while creating the template.

live preview

Error Detection

Derived will detect and show you the errors in the template editor.

Auto-completion

Derived will auto-complete the template code based on the data source. And available functions.

Change Data Source

To see template behavior with different data source, you can change the data source.

Folder Structure Preview

Folder structure on the left side of the editor will be created dynamically based on the template paths.

Example

Templates with paths:

  • src/routes/{{.schema.name}}Controller.ts
  • src/routes/{{.schema.name}}Service.ts
  • src/routes/{{.schema.name}}Routes.ts
// data source
{
    "name": "user",
}

Resolved folder structure:

userController.ts
userService.ts
userRoutes.ts

On this page