You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found the build script to be a bit lacking; there's no support for building the Material UI for android builds and Apple design for iOS builds.
Here's what worked for me, but I doubt it's a "best practices" approach.
Split main.js into a main.ios.js and main.android.js. The latter has the suggested material:true and correct CSS uncommented and iOS removed. All your Vue components should handle multi-platform builds already. (using v-if="$theme.material" where needed, etc)
hookers.js
add to sys object a new function to check if a certain platform is being run.
Note: If building both iOS and Android in one command, (cordova build ios android), platforms will have both values. For this function, it only checks if the specified platform is a part of the command, not if it is the only platform.
and change the startWebpackBuild function to take an isAndroid parameter, and use it for the exec command. (Webpack 2.0 requires passed args through the --env. prefix)
then, using isAndroid = sys.checkPlatform('android'), you update the call with our new value sys.startWebpackBuild(isRelease, isAndroid))
Now that webpack knows which platform it is building for, move the definition of the entryFile variable inside the config function, and update as follows:
webpack.config.js
let config = function (env) {
let entryFile = path.join(__dirname, env.android ? 'src/main.android.js' : 'src/main.ios.js')
....
Now you are building the platform correctly!
Background: I tried to do conditional imports inside the main.js (and therefore bypass all this by setting the needed values on runtime), but was unable to get a webpack / component-ey version working. This approach works for my needs, and hopefully can help someone else trying to have one codebase for platform agnostic native UI, (even if its a little contrived to get the variables into webpack and ultimately the F7+Vue App)
The text was updated successfully, but these errors were encountered:
I found the build script to be a bit lacking; there's no support for building the Material UI for android builds and Apple design for iOS builds.
Here's what worked for me, but I doubt it's a "best practices" approach.
Split
main.js
into amain.ios.js
andmain.android.js
. The latter has the suggested material:true and correct CSS uncommented and iOS removed. All your Vue components should handle multi-platform builds already. (usingv-if="$theme.material"
where needed, etc)hookers.js
add to
sys
object a new function to check if a certain platform is being run.Note: If building both iOS and Android in one command, (
cordova build ios android
), platforms will have both values. For this function, it only checks if the specified platform is a part of the command, not if it is the only platform.and change the
startWebpackBuild
function to take anisAndroid
parameter, and use it for the exec command. (Webpack 2.0 requires passed args through the--env.
prefix)then, using
isAndroid = sys.checkPlatform('android')
, you update the call with our new valuesys.startWebpackBuild(isRelease, isAndroid))
Now that webpack knows which platform it is building for, move the definition of the entryFile variable inside the config function, and update as follows:
webpack.config.js
Now you are building the platform correctly!
Background: I tried to do conditional imports inside the main.js (and therefore bypass all this by setting the needed values on runtime), but was unable to get a webpack / component-ey version working. This approach works for my needs, and hopefully can help someone else trying to have one codebase for platform agnostic native UI, (even if its a little contrived to get the variables into webpack and ultimately the F7+Vue App)
The text was updated successfully, but these errors were encountered: