Configuration file description


In the directory at the same level as the project, there is a global .tmtworkflowrc configuration file. There can also be a .tmtworkflowrc under the project, and the program runs First look for whether there is a configuration file in the current directory. If not, continue to search in the upper directory until the system directory

We use the rc component to manage the configuration file. If the .tmtworkflowrc file does not exist under the project, the configuration will be found based on the following optimization levels.

  • System environment variables variables starting with tmtworkflow_, (for example: tmtworkflow_foo__bar__baz => foo.bar.baz)
  • .tmtworkflowrc in the project directory or traverse upwards in order to find./ ../ ../../ ../../../
  • $HOME/.tmtworkflowrc
  • $HOME/.tmtworkflowrc/config
  • $HOME /.config/tmtworkflowrc
  • $HOME/.config/tmtworkflowrc/config
  • /etc/tmtworkflowrc
  • /etc/tmtworkflowrc/config
  • workflow Default configuration

By modifying the configuration file, you can implement related processes in custom tasks, such as whether you need to compile a WEBP resource and whether to compile HTML files to the dist directory.

.tmtworkflowrc configuration example

{
  //ftp 配置
  "ftp": {
    "host": "xx.xx.xx.xx",
    "port": "8021",
    "user": "tmt",
    "pass": "password",
    "remotePath": "remotePath", //默认上传到根目录下,配置此属性可指定具体子目录
    "includeHtml": true  //ftp 上传是否包含 html
  },

  //自动刷新
  "livereload": {
     "available": true,  //开启自动刷新
     "port": 8080,
     "startPath": "html/TmTIndex.html"  //启动时自动打开的路径
   },

   //插件功能
   //路径相对于 tasks/plugins 目录
  "plugins": {
    "build_devAfter": ["TmTIndex"],  //dev 任务执行后自动执行
    "build_distAfter": [],          //build 任务执行后自动执行
    "ftpAfter": ["ftp"]        //ftp 任务执行后自动执行
  },

  "lazyDir": ["../slice"], //gulp-lazyImageCSS 寻找目录(https://github.com/weixin/gulp-lazyimagecss)

  "supportWebp": false,  //编译使用 webp

  "supportREM": false,   //REM转换

  "reversion": false     //新文件名功能
}