项目作者: aztack

项目描述 :
⚙️A Cocos Creator Custom Build Panel
高级语言: JavaScript
项目地址: git://github.com/aztack/cc-custom-build.git
创建时间: 2020-03-04T15:07:23Z
项目社区:https://github.com/aztack/cc-custom-build

开源协议:

下载


A Cocos Creator Custom Build Panel

Installation

  1. cd ~/.CocosCreator/packages # Mac
  2. cd c:\Users\<username>\.CocosCreator\packages\ # Windows
  3. git clone https://github.com/aztack/cc-custom-build.git

Screenshot

screenshot

Custom build scripts

Cocos Docs: Custom project build template

build-start.js:

  1. module.exports = function(options /* see above cocos docs*/) {
  2. Editor.log(`Build start with options:`)
  3. Editor.warn(options);
  4. // return a promise if you need to do something asynchronous
  5. //return new Promise((resolve, reject) => {resolve()})
  6. }

build-finish.js:

  1. module.exports = function(options) {
  2. const ejs = require('ejs');
  3. const fs = require('fs');
  4. const path = require('path');
  5. const htmlPath = path.resolve(options.project, 'build/web-mobile/index.html')
  6. const tpl = fs.readFileSync(htmlPath).toString()
  7. const result = ejs.render(tpl, {
  8. project: options.title,
  9. orientation: options.webOrientation,
  10. webDebugger: ''
  11. });
  12. fs.writeFileSync(path.resolve(options.dest, 'index.html'), result);
  13. Editor.log(`Post-process index.html finished!`);
  14. }