I am trying to build a mobile app with Svelte.js and Ionic v4.
1) I got the svelte-template.
2) Installed ionic with npm install @ionic/core@latest --save.
3) Installed postcss and imported @ionic css in global.css
Rollup is extracting the @ionic css but it seems that there maybe something wrong with the way it is doing. The ionic components are acessible, but I cannot see a thing. The css is not being applied properly.
Has anyone managed to make Svelte work with Ionic v4? Or at least, Ionic with some vanilla js?
Happy to announce a full upgrade of my earlier project to integrate Ionic with Svelte. This time, improved and supercharged using Vite-power!
Ionic is simply the UI layer for an app. It provides the building blocks for your app as well as the animations and gestures for more interactive parts. Capacitor is a JS library and Native runtime. It provides a JS API for interacting with Web and Native features, in a unified api.
this is how I eventually got it to work pretty nicely
https://ionicsvelte.firebaseapp.com/
The repo:
https://github.com/Tommertom/svelte-ionic-app
And in REPLs:
https://github.com/Tommertom/svelte-ionic-app/blob/master/REPLS.md
I did. Using the CDN was easiest.
Scaffold a new app:
degit sveltejs/template myapp
Add CDN to public/index.html above the ./global.css
<!-- ionic -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.esm.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/@ionic/core/dist/ionic/ionic.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core/css/ionic.bundle.css"/>
<!-- ionicons -->
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule="" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
<script>
const greet = () => alert('hi')
</script>
<ion-app>
<ion-content>
<ion-header>
<ion-toolbar>
<ion-title>My App</ion-title>
</ion-toolbar>
</ion-header>
</ion-content>
<ion-footer>
<ion-button color="secondary" expand="block" on:click={greet}>
Greet
</ion-button>
</ion-footer>
</ion-app>
yarn && yarn dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With