简体   繁体   中英

How to get Gradle build version in index.html or in javascript

I have gradle build for my project, some of the details defined in project.ext section of build.gradle file.

project.ext {
  myVar1 = "Var1";
  myVar2 = "Var2";
  .....
}

Is there any way I can access those variables using grunt or anything to use in html file or in javascript?

Any help is much appreciated.

Yes you can do it but only through filtering - not directly - see this part of gradle docs. Basically filtering is done while copying artifacts to other destination.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM