Skip to content

Serverless plugin for templating content in serverless.yml files

License

Notifications You must be signed in to change notification settings

walery/serverless-plugin-stencil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

serverless-plugin-stencil

Serverless plugin for templating content in serverless.yml files.

Usage

serverless-plugin-stencil is a serverless plugin that can load templates into a serverless.yml file. To make it possible you need to create a npm module that is marked as stencil module. This can be done by adding @walery/serverless-plugin-stencil property to the package.json file:

{
  // ...

  "@walery/serverless-plugin-stencil": {
    "alias": "account"
  }
}

The alias property is the only one you can add. This property is mandatory and can't be omit. The alias property contains value of stencilAlias that must be unique.

Once this module is created and added as dependency, the serverless-plugin-stencil will be able to find it.

To use it in your serverless.yml file you need to do it in that way:

foo: ${stencil(<stencilAlias>):<blockName>}

The blockName is the second part that is also mandatory.

In the stencil module you need to add blocks directory on the root. In this directory you can add yaml, yml, or js files. The filename is interpreted as a blockName.

If the file is yaml or yml file then the content will be just added. If the file is a js file then the resolve function will be called. The return value will be added to the serverless.yml file.

About

Serverless plugin for templating content in serverless.yml files

Resources

License

Stars

Watchers

Forks

Packages

No packages published