Comments (5)
Here's instructions to scaffold a very barebones Astro app:
Scaffold
https://docs.astro.build/en/install/auto/
npm create astro@latest
- Name: (ex: "my-astro-skeleton-app")
- Template: empty project
- Install Deps: y
- Init Git: y
- Typescript: Strict (Recommended)
cd my-astro-skeleton-app
Integrate Svelte
https://docs.astro.build/en/guides/integrations-guide/svelte/
npx astro add svelte
Integrate Tailwind
https://docs.astro.build/en/guides/integrations-guide/tailwind/
npx astro add tailwind
Add /src/styles/base.css
and set @tailwind directives:
@tailwind base;
@tailwind components;
@tailwind utilities;
Add /src/styles/theme.css
to house your theme CSS
Standard Skeleton Setup
(follow standard Skeleton instructions to configure Tailwind and Themes)
Create an Astro Layout
Create an astro layout in /src/layouts/BasicLayout.astro
---
import '../styles/theme.css';
import '../styles/base.css';
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Astro</title>
</head>
<body>
<slot />
</body>
</html>
Update Homepage and Add Component
Update /src/pages/index.astro
to use your layout and add a basic component
---
import BasicLayout from '../layouts/BasicLayout.astro';
import { Button } from '@brainandbones/skeleton';
---
<BasicLayout>
<h1 class="mb-4">Homepage</h1>
<Button client:load variant="filled-primary">Skeleton</Button>
</BasicLayout>
NOTE: Make sure you Hydrate your components:
https://docs.astro.build/en/core-concepts/framework-components/
Notes:
- Any form of structural components and their props seem to work (ex: Buttons)
- Component slots seem to work as expected.
- Complex features, such as Dialogs, do not work (yet) as I'm not sure how to use Svelte writables with Astro
- Likewise I'm not certain on how to handle component directives and events, such as
on:click
, so we may need someone from the Astro community to provide guidance here.
from skeleton.
I've created a thread on the Astro Discord asking about how to utilize certain features that are required for some Skeleton features to operate:
https://discord.com/channels/830184174198718474/1008810187802562620
from skeleton.
FYI I had a great conversation with folks on the Astro Discord including a couple core team members. See the log in the link above.
Long story short, their recommendation is to wrap anything functional within a parent Svelte component. Here's a quick example in pseudo code:
<AstroComponent>
<SvelteWrapperComp client:load>
(anything Skeleton related can live here)
<SvelteWrapperComp>
</AstroComponent>
Here's an example of the Dialog system working within an Astro app using this structure:
Now, they do make a great point that this pattern is only required if you have logic and functionality, such as click handlers, etc. If whatever you're providing is static (ex: LogoCloud), you could embed this straight into a Astro component. No wrapper or hydration needed, which would lead to better performance.
I'll update the docs with these revisions soon, then begin applying them to the Docs.
from skeleton.
This documentation is now complete and ready for testing on branch:
feat/vite-svelte
(reused this, sorry for the poor naming!)
Note you'll need to manually disable the Menu/LightSwitch/CodeBlock in your node_modules > Skeleton > index.js
if you follow the instructions.
from skeleton.
See: #108
from skeleton.
Related Issues (20)
- Add special comment to Tailwind config to enable HRM reloading on plugin changes
- Improve intermediate page navigation UI
- favicon.png HOT 2
- Modals prerequisites should also import Modal
- error in docs
- Progress Bars: discrepancy in usage code
- Codeblocks with shiki highlighter HOT 3
- Modal rendering inconsistent. Disappearing Modals. HOT 1
- NEXT Iconography Docs
- Feature request: Support popular routers like svelte-spa-router and routify HOT 6
- NEXT React Form Handling HOT 1
- NEXT Date Picker and Date Handling HOT 1
- Installing with bun hits exception HOT 2
- Add accessibility attributes to Autocomplete HOT 1
- [Skeleton v2] - Light scrollbar is displayed instead of dark one on Opera browser HOT 4
- Autocomplete page: Add blurb about importing popup in popup section
- AppRailTile and AppRailAnchor default styling
- progressbar.css in build HOT 1
- v3 dep bump
- Possibilty to disable focus of Ratings component inner buttons HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skeleton.