Ionic项目的发布配置,类似于Android Studio中的版本 [英] Release configuration for Ionic project, similar to flavours in Android studio

查看:96
本文介绍了Ionic项目的发布配置,类似于Android Studio中的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有任何运气就看着这个.我知道我们可以通过 config.xml 文件将配置传递给Ionic项目.但是我想为开发和发布版本使用不同的配置.

Been looking into this without any luck. I understand that we can pass configuration to Ionic projects via the config.xml file. But I want to have different configuration for development and release builds.

有人知道如何做到吗?

推荐答案

这是一种使用 hook 根据要构建的特定环境更新配置文件的方法.

This is one approach that using the hooks to update a configuration file based on the specific environment you are building for.

在执行cmd作为环境指示符时,可以使用配置变量.

You use a configuration variable when executing the cmd as the indicator of the environment.

config_target = qa cordova build --release android ios

然后在钩子中,检查变量

then in the hook, check for the variable

var config_target = process.env.config_target ||当地的";//默认为本地

http://www.kdmooreconsulting.com/blogs/build-a-cordova-hook-to-setup-environment-specific-constants/

这篇关于Ionic项目的发布配置,类似于Android Studio中的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆