Git Product home page Git Product logo

Comments (5)

endigo9740 avatar endigo9740 commented on May 18, 2024

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/

Screen Shot 2022-08-15 at 12 56 54 PM


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.

endigo9740 avatar endigo9740 commented on May 18, 2024

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.

endigo9740 avatar endigo9740 commented on May 18, 2024

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:

Screen Shot 2022-08-15 at 2 45 38 PM

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.

endigo9740 avatar endigo9740 commented on May 18, 2024

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.

endigo9740 avatar endigo9740 commented on May 18, 2024

See: #108

from skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.