Create a new project
Create a COCOS2D-JS project:
cocos new projectName -l js
Create a project that supports only Web platforms:
cocos new projectName -l js --no-native
To create a project to the specified directory:
cocos new projectName -l js -d ./Projects
Run the project
To run a Web version project using a browser:
cd directory/to/projectcocos run -p web
Compress scripts and publish Web versions using closure compiler Advanced Mode:
cd directory/to/projectcocos compile -p web -m release --advanced
Compile and run the project on the native platform:
cd directory/to/projectcocos compile -p ios|mac|android|win32cocos run -p ios|mac|win32|android
Options
-p platform : 平台:ios|mac|android|win32|web.-s source : 项目目录,如果没有指明会使用当前路径。-q : 静默模式,不打印log信息。-m mode : 选择debug或release模式,默认为debug模式--source-map: 生成source-map文件。(仅限Web平台)--advanced : 使用Closure Compiler高级模式压缩脚本。(仅限Web平台)
Help commands
If you have any questions about using it, you can use it after the command -h to get help with the corresponding command. Here are all the commands:
- Create:
new
- Compile:
compile
- Run:
run
Original address: http://www.cocos.com/doc/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/ Html5/v2/cocos-console/zh.md
Cocos Console Command