Skip to content
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

How to add Kahi-ui to a blank svelte template page #45

Closed
Thom087 opened this issue Sep 11, 2021 · 4 comments
Closed

How to add Kahi-ui to a blank svelte template page #45

Thom087 opened this issue Sep 11, 2021 · 4 comments
Labels
docs Issue is related to the Kahi UI Documentation

Comments

@Thom087
Copy link

Thom087 commented Sep 11, 2021

Describe the Request

I am pretty new to svelte and Kahi-ui seems to be very nice. However I tried to add it into the demo project from npx degit sveltejs/template my-svelte-project means I adjusted the App.svelte with the import from '@kahi-ui/framework'. Everything is fine, despite that the css is not applied.
Nevertheless the files are on the server:
image
Do I miss some configuration? Could you improve the docs how to get started?

Additional Context

No response

@novacbn novacbn added the docs Issue is related to the Kahi UI Documentation label Sep 12, 2021
@novacbn
Copy link
Owner

novacbn commented Sep 12, 2021

Quickly made a new template based on the template you used, which you can find at kahi-framework/kahi-ui-template-svelte. You should be able to just use degit but pointing to that repo. e.g. npx degit kahi-framework/kahi-ui-template-svelte my-svelte-project (probably, never used degit before)

To reproduce your issue and make the template. I just followed the instructions outlined in the Getting Started section of the documentation. And made some changes specific to the template:

Installed library via npm

npm install @kahi-ui/framework

Updated main.js with Kahi UI stylesheet import

+import "@kahi-ui/framework/dist/kahi-ui.framework.css";

import App from './App.svelte';

const app = new App({
	target: document.body,
	props: {
		name: 'world'
	}
});

export default app;

Changed App.svelte to use Kahi UI Components and removed template styles

<script>
+	import {Anchor, Container, Heading, Text} from "@kahi-ui/framework";

	export let name;
</script>

+<Container is="main">
+	<Heading>Hello {name}!</Heading>
+	<Text>Visit the <Anchor href="https://svelte.dev/tutorial">Svelte tutorial</Anchor> to learn how to build Svelte apps.</Text>
+</Container>

-<main>
-	<h1>Hello {name}!</h1>
-	<p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
-</main>
-
-<style>
-	main {
-		text-align: center;
-		padding: 1em;
-		max-width: 240px;
-		margin: 0 auto;
-	}
-
-	h1 {
-		color: #ff3e00;
-		text-transform: uppercase;
-		font-size: 4em;
-		font-weight: 100;
-	}
-
-	@media (min-width: 640px) {
-		main {
-			max-width: none;
-		}
-	}
-</style>

Removed global.css reference and file

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset='utf-8'>
	<meta name='viewport' content='width=device-width,initial-scale=1'>

	<title>Svelte app</title>

	<link rel='icon' type='image/png' href='/favicon.png'>
-	<link rel='stylesheet' href='/global.css'>
	<link rel='stylesheet' href='/build/bundle.css'>

	<script defer src='/build/bundle.js'></script>
</head>

<body>
</body>
</html>

Which should result in the following output:

Screenshot from 2021-09-12 01-10-57

Let me know if the steps above helps you figure out your situation. Also, since most of the steps above are specific to the template, I'm not sure any updating is required for the documentation.

@Thom087
Copy link
Author

Thom087 commented Sep 12, 2021

Awesome, thanks a lot! I think it is fine that you mentioned it at Resources -> Official -> Templates on the documentation page.
Nevertheless the npx degit kahi-framework/kahi-ui-template-svelte my-svelte-project is not working. The error log is as follows:

! could not fetch remote https://github.com/kahi-framework/kahi-ui-template-svelte
! could not find commit hash for HEAD

@novacbn
Copy link
Owner

novacbn commented Sep 12, 2021

I tried to replicate your issue on my systems and couldn't. Looking into it, it could relate to multiple problems as described in Rich-Harris/degit#37. For instance, I was able to replicate it when I removed git from global $PATH.

@Thom087
Copy link
Author

Thom087 commented Sep 12, 2021

It works after updating Git from version 2.13.0.windows.1 to the latest version 2.33.0.windows.2.
Thanks a lot for your support and your very fast responses!

@Thom087 Thom087 closed this as completed Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Issue is related to the Kahi UI Documentation
Projects
None yet
Development

No branches or pull requests

2 participants