Skip to content

hopemanryan/goschematics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A schematics engine written in go in-order to innovate the schematics niche and increase development speed.

Install

npm install -D hopemanryan/gschema

How to use

Templates

  • Templates files must end with a __templ__ suffix
  • The regex pattern for dynamic content is: <% file_name =%> (in the context file_name is a variable)
  • You can add dynamic variables to file names <% file_name =%>Component.ts__templ__
  • Javascript functions are supported (see more down bellow)

Example

const <% toUpperCase(file_name) =%>Component = () => {

}


const <% file_name =%>Component = () => {

}

Basic usage

node ./node_modules/gschema/gschema.js -file_name=demo1 -read_dir=./abc

JS functions

Schematics are more popular in the Javascript community. There for we have added support to add a JS file that will have functions which can be used in the template files

// gschema.js
function toUpperCase (val) {
    return val.toUpperCase();
}

This will load the function and the engine sees toUpperCase it will run the function with variable value as the argument toUpperCase('demo1') and return the value DEMO1

Shorthands

gschema.config.json is the config file that can be used for shorthands configuration

{
    "shorthands": {
        "demo": {
            "templatePath": "./abc"
        }
    }
}
node ./node_modules/gschema/gschema -file_name=demo1 -s=demo

The engine will use the predefined config, this allows true re-usability of templates

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published