Make template file source update
Pre-release
Pre-release
Make Templates
Migrated make to source template files from the config/make/ directory. Previously template files were stored in the config/make.js file as strings;
const templates = {
'markup': [
"/",
"/ {{ Pattern }}",
"/",
"",
"div class=\"{{ prefix }}{{ pattern }}\""
].join("\n"),
'markdown': [
"",
"**Source:** `src/{{ type }}/{{ pattern }}/{{ pattern }}`",
"",
"About the {{ Pattern }} {{ type }}.",
].join("\n"),
'styles': [
...
],
...
}
Templates are now sourced from actual files in the config/make/
directory;
config/make/markdown.md
config/make/markup.slm
config/make/readme.md
config/make/view.slm
config/make/script.js
config/make/config.scss
config/make/style.scss
The contents of the files remain the same.
Migration
- Move contents of the
templates
object in the config/make.js into newly created files listed above. If you do not wish to create your own templates you can simply omit the file and rely on the framework's defaults. - Remove the variable and module.export instance of
templates
from the config/make.js file.
Other optional suggestions
- Update the keys in each config/make.js configuration object from
views
,scripts
andstyles
to their singularview
,script
andstyle
. This allows you to typenpx pttrn make component view
when you need to add an extra file to a pattern (slightly easier to remember?). - Add
'readme'
to thepatterns
andoptional
constant so that it isn't created automatically.
Recursive
Make now implements the recursive option for making files. If a directory for a pattern does not exist in a project it will be created.