当前位置:网站首页>more-copy. JS specifies that the file template is generated to the specified file directory
more-copy. JS specifies that the file template is generated to the specified file directory
2022-06-12 20:01:00 【Pengshiyu】
more-copy.js
The specified file template is generated to the specified file directory
install
# Global installation is recommended
npm i more-copy -g
Use
1、 Command line
$ mcp [ Template path ] [ The output path ] [-p json character string ] [-c Profile path ]
eg:
$ mcp template.js demo.js
Parameters
-c Specify the profile path The default is ./more-copy.config.js
-p Pass in the parameter , receive json Format string
2、 user designation codes
const {
renderToFile } = require('more-copy');
renderToFile({
input, output });
Templates
Template rendering based on Nunjuck.js, The implication , Support Nunjuck.js All template syntax for
https://nunjucks.bootcss.com/templating.html
Command line
Usually , The file generation path of a project is fixed , Can combine package.json perhaps make Simplify the command line
To configure
The current directory can be configured more-copy.config.js
// Plug in Example
const {
MkdirPlugin, ParsePlugin, TimePlugin } = require('more-copy');
// Use custom plug-ins
const CustomPlugin = require('./custom-plugin.js');
module.exports = {
// Open the debug
debug: true,
// The use of plug-in , In order
plugins: [new CustomPlugin()],
};
The plug-in has been implemented
Users can use plug-ins to give options Add parameter
The plug-in contract adds options Properties on objects , Name the plug-in , Except for special .
for example : Use ParsePlugin Attributes will be added options.parse
// Plug in base class , Custom plug-ins are recommended to inherit this base class , And implement its method
Plugin(options);
// 1、 Create target folder recursively
MkdirPlugin();
// 2、 Change the naming style of the output file name , Support naming-style All style parameters of
// eg: {style: 'pascal'}
OutputNamingPlugin({
style });
// 3、 Resolve path parameters
ParsePlugin();
// 4、ThinkPHP Required parameters
// Support additional parameters -p '{"name": "table_name"}'
ThinkphpPlugin({
prefix: ' Table prefix ' });
// 5、 Time plug in
TimePlugin();
// 6、Vue Required parameters
// Support additional parameters -p '{"name": "name"}'
VuePlugin();
// 7、 from MySQL Query data in
// -p '{sql, data}'
MySQLPlugin({
config
});
// 8、 from MySQL Query table data in
// -p '{table}'
TablePlugin({
config
});
// 9、 Change the naming style of the output folder , Support naming-style All style parameters of
OutputDirnameNamingPlugin({
style})
Custom plug in
custom-plugin.js Used to process template input parameters
const Plugin = require('more-copy');
class CustomPlugin extends Plugin {
process_options(options) {
options.custom = {
name: 'Tom',
};
return options;
}
}
module.exports = CustomPlugin;
边栏推荐
- 7 R read / write data
- Deep feature synthesis and genetic feature generation, comparison of two automatic feature generation strategies
- Is online futures account reliable? Is it safe to open an online futures account?
- 用户权限和组权限
- 基于微信电子书阅读小程序毕业设计毕设作品(4)开题报告
- What does MySQL full value match mean
- In 2022, FISCO bcos MVP recognized that the channel was open and invited you to become an open source leader
- Microsoft Word tutorial, how to insert a header or footer in word?
- 1. Getting to know R
- Understanding of data in memory
猜你喜欢

Understand Jack Dorsey's web5 from the ppt on page 16

基于微信电子书阅读小程序毕业设计毕设作品(7)中期检查报告

In 2022, 20 cities with the largest number of college students in China

Macro definitions and functions

7:00 tonight | application of PhD debate self supervised learning in Recommendation System

PostgreSQL数据库复制——后台一等公民进程WalReceiver pg_stat_wal_receiver视图

Parameter meaning of random forest randomforestclassifier in sklearn

7 R read / write data

User and group permissions

Wechat e-book reading applet graduation design work (6) opening defense ppt
随机推荐
2022年,中国大学生最多的20个城市
SPI one master and many slaves
QT -- how to get the contents of selected cells in qtableview
Hardware test - why not use grounding clip for ripple test
How to make a computer installation and startup USB flash disk
API call display, detailed API of Taobao, tmall and pinduoduo commodity pages, and return of APP side original data parameters
Continuously improve the overall performance of adaoracle Oracle Oracle
登錄mysql
WordPress optimization tutorial makes WordPress open faster
Overview of object detection
Demand and business model innovation - demand 2- demand basis
Test prerequisites: recommend a special cross platform app performance test tool!
Index optimization principle
Demand and business model innovation - demand 3- demand engineering process
Axure RP 9 for Mac(交互式产品原型设计工具)中文版
Equipment management - borrowing and returning module 1
新来的同事问我 where 1=1 是什么意思???
Learning summary in March
Connectez - vous à MySQL
Interpreter Files