Skip to content

aztack/cc-custom-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Cocos Creator Custom Build Panel

Installation

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

Screenshot

screenshot

Custom build scripts

Cocos Docs: Custom project build template

build-start.js:

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

build-finish.js:

module.exports = function(options) {
  const ejs = require('ejs');
  const fs = require('fs');
  const path = require('path');
  const htmlPath = path.resolve(options.project, 'build/web-mobile/index.html')
  const tpl = fs.readFileSync(htmlPath).toString()
  const result = ejs.render(tpl, {
    project: options.title,
    orientation: options.webOrientation,
    webDebugger: ''
  });
  fs.writeFileSync(path.resolve(options.dest, 'index.html'), result);
  Editor.log(`Post-process index.html finished!`);
}