-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No hooks for Platform specific UI #58
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: