0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
The web framework for content-driven websites. ️ Star to support our work!
Find a file
Matthew Phillips 54ba9f5ee1
Fix complex MDX parsing (#50)
* Fix complex MDX parsing

This allows fully MDX support using the micromark MDX extension. One caveat is that if you do something like use the less than sign, you need to escape it because the parser expects these to be tags otherwise.

* Move micromark definition
2021-04-01 16:34:11 -04:00
.github Extract Astro styles to external stylesheets (#43) 2021-03-31 13:04:18 -06:00
.vscode Scaffold language server (#25) 2021-03-25 10:38:17 -05:00
examples Fix complex MDX parsing (#50) 2021-04-01 16:34:11 -04:00
prism-astro Add prism and skeleton www page (#49) 2021-04-01 15:16:29 -04:00
src Fix complex MDX parsing (#50) 2021-04-01 16:34:11 -04:00
test Fix complex MDX parsing (#50) 2021-04-01 16:34:11 -04:00
vscode Scaffold language server (#25) 2021-03-25 10:38:17 -05:00
www Add prism and skeleton www page (#49) 2021-04-01 15:16:29 -04:00
.eslintignore Annoying Lint PR #2 (#47) 2021-04-01 10:25:28 -06:00
.eslintrc.cjs Annoying Lint PR #2 (#47) 2021-04-01 10:25:28 -06:00
.gitignore Scaffold language server (#25) 2021-03-25 10:38:17 -05:00
.prettierrc.json Annoying Lint PR™ (#3) 2021-03-16 12:37:45 -06:00
astro.mjs Add a proper cli 2021-03-15 15:26:23 -04:00
LICENSE Bring compiler into Astro (#4) 2021-03-16 16:08:11 -04:00
package-lock.json Fix complex MDX parsing (#50) 2021-04-01 16:34:11 -04:00
package.json Fix complex MDX parsing (#50) 2021-04-01 16:34:11 -04:00
README.md Convert CSS Modules to scoped styles (#38) 2021-03-30 10:11:21 -06:00
snowpack-plugin.cjs Extract Astro styles to external stylesheets (#43) 2021-03-31 13:04:18 -06:00
tsconfig.json initial commit 2021-03-15 13:22:05 -04:00

👩‍🚀 Astro

A next-generation static-site generator with partial hydration. Use your favorite JS framework and ship bare-minimum JS (or none at all!).

🔧 Setup

npm install astro

TODO: astro boilerplate

🧞 Development

Add a dev npm script to your /package.json file:

{
  "scripts": {
    "dev": "astro dev ."
  }
}

Then run:

npm run dev

💧 Partial Hydration

By default, Astro outputs zero client-side JS. If you'd like to include an interactive component in the client output, you may use any of the following techniques.

  • MyComponent:load will render MyComponent on page load
  • MyComponent:idle will use requestIdleCallback to render MyComponent as soon as main thread is free
  • MyComponent:visible will use an IntersectionObserver to render MyComponent when the element enters the viewport

💅 Styling

If youve used Sveltes styles before, Astro works almost the same way. In any .astro file, start writing styles in a <style> tag like so:

<style>
.scoped {
  font-weight: bold;
}
</style>

<div class="scoped">Im a scoped style</div>

Sass

Astro also supports Sass out-of-the-box; no configuration needed:

<style lang="scss">
@use "../tokens" as *;

.title {
  color: $color.gray;
}
</style>

<h1 class="title">Title</h1>

Supports:

  • lang="scss": load as the .scss extension
  • lang="sass": load as the .sass extension (no brackets; indent-style)

Autoprefixer

We also automatically add browser prefixes using Autoprefixer. By default, Astro loads the default values, but you may also specify your own by placing a Browserslist file in your project root.

🚀 Build & Deployment

Add a build npm script to your /package.json file:

{
  "scripts": {
    "dev": "astro dev .",
    "build": "astro build ."
  }
}

Then run:

npm run build

Now upload the contents of /_site_ to your favorite static site host.