New From Nunjucks Template
Table of Contents
Click me to Open/Close the directory listing
Marketplace
Visual Studio Marketplace
Introductions
Creates a new file/folder structure from nunjucks template
Features
- Generate files through nunjucks templates
- Support global parameters and local parameters
- Support creating callbacks before and after
Template Preparation
Template Directory Structure
.templates
├─ template_file (Template Name) [Single File Template]
│ └─ @@config.js (Template Replacement Parameter List Configuration File)
│ └─ @@params.js (Template Replacement Parameter Object) [optional]
│ └─ file_name.js (Template File)
├─ template_folder (Template Name) [Folder Template]
│ └─ @@config.js (Template Parameter List Configuration File)
│ └─ component_name (Template Folder)
│ └─ file_name.css
│ └─ file_name.html
│ └─ file_name.js
├─ callback.js (Callback)
└─ global.js (Global Parameter)
@@config.js
exports.fileParams = ["file_name"];
exports.templateParams = [];
@@params.js
module.exports = () => {
return {
fileParams:{
file_name: 'helloworld',
},
templateParams:{
content: 'hello',
}
};
};
@@callback.js
exports.newFolder = (path, params) => {
console.log(path,params);
};
exports.newFile = (path) => {
console.log(path);
};
exports.finish = () => {
console.log("finish");
};
Template Language
use nunjucks
Usage
Example of Creating WeChat Mini Program Code with Templates
Example of Creating WeChat Mini Program Code with Templates and Auto registry app.json
Recommend
ChangeLog
ChangeLog
License
License MIT
| |