Initialize
If you need to add a new page after the project’s scaffold is initialized, you can simply copy and paste relevant content or use the following commands to add page definitions and component definitions.
init-page
Command syntax
kylin init-page <pageName>
Precautions
pageName
in the preceding command is a required parameter, and it specifies the English name of the page to be created.If the current cwd contains
package.json
with thekylinApp
field, the newpage
will be automatically added tokylinApp.pages
.
init-component
Command syntax
kylin init-component <componentName>
Precautions
componentName
in the preceding command is a required parameter, and it specifies the English name of the component to be created.If the current cwd contains
package.json
withkylinApp.pages
specifying more than one page, the system prompts the specificpage/components
directory for the newly created component.
Build
This part describes the command syntax for tool building, and the build prompt for public resource package injection.
Command syntax
kylin build # ... args
Items
Commonly used parameters
kylin build --dev # dev building and static server
kylin build --server --no-prod --hot # dev building, static server, and hot update enabling
kylin build --server # prod building and static server
kylin build --no-prod --watch # dev building and listening on file changes
Command line input parameters
Parameter | Type | Note |
---|---|---|
dev | Boolean | Similar to the original build tool, it uses the dev conf and enables the server. If this parameter is enabled, the following settings will be forcibly made: |
no-prod | Boolean | When |
server | Boolean | Only the static server is enabled. When this parameter is enabled, the following setting is forcibly made: |
verbose | Boolean | The webpack output details. |
watch | Boolean | Whether to monitor file changes. |
no-compress | Boolean | Whether to disable compression. Compression is enabled by default. |
no-common | Boolean | Whether to disable |
hot | Boolean | Whether to enable hot update. Hot update is disabled by default. This parameter is used only when |
open [entry] | Boolean, String | This parameter is valid only for |
mock | Boolean, String | This parameter is used to enable the |
kylinApp
configuration options
Parameter | Type | Description |
---|---|---|
devPort | Number | Default listening IPv4 port 0.0.0.0:8090. |
pageTemplate | String | Page template path. |
output | String | Relative output directory. |
options | Object | Additional options. |
dirAlias | Object | Equivalent to |
Build prompt
Public resource package injection
<script>
/<link>
labels corresponding to the following require
/import
package paths are automatically injected into HTML
.
Package name | Mapping global object | Mapping path |
---|---|---|
fastclick | FastClick | as.alipayobjects.com/g/luna-component/luna-fastclick/0.1.0/index.js |
vue | Vue | a.alipayobjects.com/g/h5-lib/vue/2.1.6/vue.min.js |
es6-promise | Promise | as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js |
fetch | fetch | as.alipayobjects.com/g/component/fetch/1.0.0/fetch.min.js |
zepto | Zepto | a.alipayobjects.com/amui/zepto/1.1.3/zepto.js |