diff options
author | 2021-10-29 13:30:22 -0600 | |
---|---|---|
committer | 2021-10-29 15:30:22 -0400 | |
commit | d84bfe719a546ad855640338d5ed49ad3aa4ccb4 (patch) | |
tree | ac63062651c36bcd73194c2950e160d225b5575b /examples | |
parent | 61e6bff5b1bac9f48e31ce10236858c420cd6ce7 (diff) | |
download | astro-d84bfe719a546ad855640338d5ed49ad3aa4ccb4.tar.gz astro-d84bfe719a546ad855640338d5ed49ad3aa4ccb4.tar.zst astro-d84bfe719a546ad855640338d5ed49ad3aa4ccb4.zip |
π Astro Next (0.21.0) (#1406)
* make astro-root uids unique
* Move Astro to Vite
* Update tests
* More test improvements
* fred fixes
* Update compiler, improve tests
* Fix runtime, improve code frame
* Add Markdown support
* Tycho fixes
* Fred fixes part 2
* Throw Error for WIP Features
* Improve testing suite
* Allow users to pass config to Vite
* Fix npm install (#1407)
* Automate publish on merge (#1408)
* Add NPM_TOKEN to publish script (#1409)
* Create .npmrc
* Clean up astro deps (#1411)
* Use new renderers (#1412)
* feat: update compiler (#1421)
* Try mocha/chai test runners (#1418)
* Try mocha/chai test runners
* Disable failing smoke test for now
Will revert when next can build docs
* Enable mocha in parallel mode
* Remove warning
* Update docs
* Fix Windows bug
* Fix internal imports
* Fix styles
* Fix CI release on merge to next (#1427)
* Fix logger locale parsing (#1439)
* fix(logger): locale parsing
* Fixed issue of compiler crash when "c" locale was encountered
* Return default locale if parsed locale is less than 2 chars long
* chore: add changeset
* Apply changes from #1387
* Add back in support for children (#1486)
* Add back in support for children
* Be more careful
* Enables most slot tests (#1494)
* Enables most slot tests
* Use spreadAttributes
* Add hydration to Solid renderer (#1479) (#1495)
* feat: add hydration to Solid renderer
* fix: intersection observer, move script to the end
Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
* [next] support Astro.slots API (#1516)
* [next] Support for custom elements (#1528)
* [next] Support for custom elements
* Fix eslint errors
* eslint again
* [next] Fix Astro.fetchContent (#1480)
* fix Astro.fetchContent
* fix(fetchContent): cast type
Co-authored-by: Nate Moore <nate@skypack.dev>
* Move hydration to the compiler (#1547)
* Move hydration to the compiler
* Move extracting url, export to util fn
* Brings back astro-dynamic tests (#1548)
* Implements top-level Astro + Astro.resolve (#1556)
* Implements top-level Astro + Astro.resolve
* Fix linting
* [next] Update renderers (#1509)
* chore: update vite
* fix(renderers): point renderers to resolved server/client entrypoints
* Chore: Enable more tests with new compiler changes (#1558)
* [Next] `fetch` support (#1563)
* fix: polyfill fetch in every ssr scenario
* test(fetch): update fetch tests
* docs: update data fetching guide to remove caveats about `fetch` and isomorphic usage
* refactor: update regex for clarity
* Restructure (#1569)
* Upgrade to @astrojs/compiler 0.2.0 (#1584)
* Use Vite fork (#1585)
* Use Vite fork
* Fix linting
* Move Vite to vendor/ and add a license
* Fix linting
* Include the dist folder
* Update files config
* Markdown compilation (#1593)
* Markdown compilation
* remove debugger
* Gets lit hydration working (#1595)
* Gets Astro.fetchContent compilation to work (#1596)
* Gets Astro.fetchContent compilation to work
This fixes Astro.fetchContent so that we handle esbuild transforming the
name of the nested Astro call.
* Remove debugging
* Update the tests
* Remove another debugger
* Update Vite to latest (#1597)
* Add Prism syntax highlighting (#1598)
* Scoped styles with markdown (#1599)
* Bugfix: fix getStaticPaths() cache miss (#1602)
* Fix build order (#1609)
* Bugfix: restore build to get all paths earlier, when build. Same as main.
* Also re-add timings
* [next] blog example fully working (#1610)
* Add environment variables docs (Closes #873) (#1587)
* Added environment variables docs (Closes #873)
* Fixed prefix
* Remove numbered comments (#1611)
* Chore: remove numbered comments
* Clean up block comments
* comment style fixes (#1614)
* [next] Upgrade compiler (#1619)
* [next] Upgrade compiler
* Upgrade to latest compiler
* Fix the path to global css
* Removed debugger
* feat: add fragment support to vite-plugin-astro (#1600)
* [next] fix `.tsx` handling (#1620)
* fix: support tsx in JSX plugin
* fix: preserve JSX via esbuild, only use Babel for JSX compilation
* fix: handle upcoming Vite API for `ssr` flag
* [next] Add CSS preprocessing (#1589)
* Add concept for style support in Astro
* Update style preprocessor to use new compiler
* fix: massage preprocessStyle type
* fix: @astrojs/compiler types
Co-authored-by: Nate Moore <nate@skypack.dev>
* fix issues in blog-multiple-authors (#1621)
* Move Sass to deps (#1622)
* Update renderer API for Vite (#1623)
* Update renderer API for Vite
* Fix lit-element tests
* Clean up comments
* Throw friendly error if renderer provides viteConfig in a bad format
* Fix changesets (#1628)
* Remove cheerio scanning from build stats (#1629)
* Minor change to jsxTransformOptions, update Renderer API docs (#1630)
* [next] docs example fully working (#1627)
* [next] docs example fully working
* Upgrade compiler to unlock docs
* Add `class:list` directive (#1612)
* Add support for class:list directive
The `class:list` directive serializes an expression of css class names. For React components, `className:list` is also supported.
* Remove `className` support and React tests
* Add tests for the absence of omitted classes
* fix: `define:vars` scoping for styles (#1632)
* feat: fix Debug component (#1633)
* [next] Fix `<Markdown>` component (#1631)
* fix: cleanup issues with <Markdown> component
* fix: fix `content` usage with Markdown
* [next] Fix `<Code>` component (#1635)
* fix: enable Code component
* test: update expect to chai format
* Fixes solid (#1634)
* Fixes solid
* Rename the test
* Rebase with next
* Skip solid test for now
* Add support for markdown plugins (#1650)
* Fix broken next release (#1652)
* Prevent passing to Svelte components
* Prevent passing class to Vue components
* Add CSS injection, fix portfolio example (#1648)
* Fix portfolio example
* Add .pcss extension
* Update load ssr opts
* Update packages/astro/src/runtime/server/index.ts
Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com>
* Fixes external HMR (#1654)
* Upgrade compiler version (#1655)
Fixes docs and blog examples
* Resolve renderers relative to the projectRoot (#1659)
* Template fixes (#1656)
* fix: dedupe hashes for identical islands (#1660)
* fix: scope `define:vars` to `:root` for `<style global>` (#1663)
* chore: update compiler to latest (#1664)
* [next] fix island hydration inside of `<Markdown>` (#1665)
* fix: create rehype plugin to smooth over island hydration bugs
* refactor: remove debug code
* chore: explain need for `rehypeIslands`
* Bugfix: renderer-lit missing files on npm (#1669)
* Force Vite to rebuild dependencies (#1670)
* [next] Add `preact/compat` renderer (#1668)
* feat: add preact/compat entry for `@astrojs/renderer-preact`
* Update index.js
* Bugfix: plugin-astro-fetch tries to append node-fetch to node-fetch (#1671)
* Fix Vite race condition (#1674)
* Fix with-nanostore deps (#1675)
Adds missing Solid renderer
* [next] Fix `resolveDependency` on Windows (#1666)
* fix: Windows issue with resolveDependency util
* chore: add comment
* Update CONTRIBUTING.md (#1677)
* Prevent scanning a user's deps (#1678)
* Prevent scanning a user's deps
* Remove unused things
* remove unused util
* Adding a changeset for the remark plugin
* Config changes needed for stater template (#1680)
This does 2 things:
1. Adds prismjs as a dep.
2. Adds shiki as an external.
* Next bugs (#1681)
* fix(#1679): hoisted <script> rendering
* fix(#1679): do not print global for styles, but do for scripts
* fix: update ObjectSet implementation
* fix: dedupe elements in sets
* [next] update compiler (#1683)
* chore: update compiler
* chore: update compiler (again)
* Fix Astro HMR bottleneck (#1684)
* Bugfix: JSX renderers can be declared in any order (#1686)
* chore: update compiler (#1690)
* Exclude lit-server from being optimized (#1691)
This should get the lit example working from `npm`.
* fix: exclude all renderer server entrypoints (#1692)
* chore: update compiler (#1705)
* fix: do not crash when Markdown has no content (#1702)
* feat: improve support for third-party React packages (#1701)
* Remove prism warning when no language is provided (#1703)
* Remove prism warning when no language is provided
* Add the plaintext language instead
* retry deploy
* chore: enter prerelease mode under `next` (#1707)
* Updates to the changesets (#1708)
* Updates to the changesets
* Adds a changeset for astro-prism
Co-authored-by: Fred K. Schott <fkschott@gmail.com>
Co-authored-by: Nate Moore <nate@skypack.dev>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Co-authored-by: Pranav Karawale <52596591+obnoxiousnerd@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
Co-authored-by: AsyncBanana <58297401+AsyncBanana@users.noreply.github.com>
Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com>
Diffstat (limited to 'examples')
55 files changed, 194 insertions, 357 deletions
diff --git a/examples/blog-multiple-authors/package.json b/examples/blog-multiple-authors/package.json index 05de3e6d1..9964ef6e4 100644 --- a/examples/blog-multiple-authors/package.json +++ b/examples/blog-multiple-authors/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/blog-multiple-authors/public/authors/don.jpg b/examples/blog-multiple-authors/public/images/don.jpg Binary files differindex 4419679de..4419679de 100644 --- a/examples/blog-multiple-authors/public/authors/don.jpg +++ b/examples/blog-multiple-authors/public/images/don.jpg diff --git a/examples/blog-multiple-authors/public/authors/sancho.jpg b/examples/blog-multiple-authors/public/images/sancho.jpg Binary files differindex 2c2b0c6bd..2c2b0c6bd 100644 --- a/examples/blog-multiple-authors/public/authors/sancho.jpg +++ b/examples/blog-multiple-authors/public/images/sancho.jpg diff --git a/examples/blog-multiple-authors/src/data/authors.json b/examples/blog-multiple-authors/src/data/authors.json index e958e7cd1..1eeff3766 100644 --- a/examples/blog-multiple-authors/src/data/authors.json +++ b/examples/blog-multiple-authors/src/data/authors.json @@ -1,10 +1,10 @@ { "don": { "name": "Don Quixote", - "image": "/authors/don.jpg" + "image": "/images/don.jpg" }, "sancho": { "name": "Sancho Panza", - "image": "/authors/sancho.jpg" + "image": "/images/sancho.jpg" } } diff --git a/examples/blog-multiple-authors/src/pages/authors/[author].astro b/examples/blog-multiple-authors/src/pages/authors/[author].astro index 13f24c829..a4dbeb129 100644 --- a/examples/blog-multiple-authors/src/pages/authors/[author].astro +++ b/examples/blog-multiple-authors/src/pages/authors/[author].astro @@ -1,17 +1,17 @@ --- + import MainHead from '../../components/MainHead.astro'; import Nav from '../../components/Nav.astro'; import PostPreview from '../../components/PostPreview.astro'; import Pagination from '../../components/Pagination.astro'; - -// page -let title = 'Donβs Blog'; -let description = 'An example blog on Astro'; -let canonicalURL = Astro.request.canonicalURL; - -// collection import authorData from '../../data/authors.json'; +export function getStaticPaths() { + const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); + let allAuthorsUnique = [...new Set(allPosts.map(p => p.author))]; + return allAuthorsUnique.map(author => ({params: {author}, props: {allPosts}})); +} + interface MarkdownFrontmatter { date: number; description: string; @@ -19,14 +19,10 @@ interface MarkdownFrontmatter { author: string; } -export function getStaticPaths() { - const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); - let allAuthorsUnique = [...new Set(allPosts.map(p => p.author))]; - return allAuthorsUnique.map(author => ({params: {author}, props: {allPosts}})); -} - const { allPosts } = Astro.props; -const { params } = Astro.request; +const { params, canonicalURL } = Astro.request; +const title = 'Donβs Blog'; +const description = 'An example blog on Astro'; /** filter posts by author, sort by date */ const posts = allPosts diff --git a/examples/blog-multiple-authors/src/pages/posts/[...page].astro b/examples/blog-multiple-authors/src/pages/posts/[...page].astro index 65b4067fc..b615d762f 100644 --- a/examples/blog-multiple-authors/src/pages/posts/[...page].astro +++ b/examples/blog-multiple-authors/src/pages/posts/[...page].astro @@ -3,20 +3,8 @@ import MainHead from '../../components/MainHead.astro'; import Nav from '../../components/Nav.astro'; import PostPreview from '../../components/PostPreview.astro'; import Pagination from '../../components/Pagination.astro'; - -// page -let title = 'Donβs Blog'; -let description = 'An example blog on Astro'; -let canonicalURL = Astro.request.canonicalURL; - -// collection -interface MarkdownFrontmatter { - date: number; - description: string; - title: string; -} - import authorData from '../../data/authors.json'; + export async function getStaticPaths({paginate, rss}) { const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); const sortedPosts = allPosts.sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf()); @@ -39,6 +27,19 @@ export async function getStaticPaths({paginate, rss}) { return paginate(sortedPosts, {pageSize: 1}); } +// page +let title = 'Donβs Blog'; +let description = 'An example blog on Astro'; +let canonicalURL = Astro.request.canonicalURL; + +// collection +interface MarkdownFrontmatter { + date: number; + description: string; + title: string; +} + + const { page } = Astro.props; --- diff --git a/examples/blog/package.json b/examples/blog/package.json index 2d2a048f0..3deb4aca0 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/blog/public/blog.css b/examples/blog/public/blog.css index 9264f4e02..1bd7479ce 100644 --- a/examples/blog/public/blog.css +++ b/examples/blog/public/blog.css @@ -90,31 +90,19 @@ body { } body { - display: flex; - flex-direction: column; - min-height: 100vh; font-family: var(--font-body); font-size: 1rem; font-size: clamp(0.875rem, 0.4626rem + 1.0309vw + var(--user-font-scale), 1.125rem); line-height: 1.625; } -body { +.wrapper { + margin-left: auto; + margin-right: auto; + max-width: 65em; + padding-left: 2rem; + padding-right: 2rem; width: 100%; - display: grid; - --gutter: 0.5rem; - --doc-padding: 2rem; -} - -.layout { - display: grid; - grid-auto-flow: column; - grid-template-columns: minmax(var(--gutter), 1fr) minmax(0, var(--max-width)) minmax(var(--gutter), 1fr); - gap: 1em; -} - -.layout > :is(main, article) { - grid-column: 2; } nav ul { diff --git a/examples/blog/src/components/BlogHeader.astro b/examples/blog/src/components/BlogHeader.astro index 347ce3a05..92d0cbfb1 100644 --- a/examples/blog/src/components/BlogHeader.astro +++ b/examples/blog/src/components/BlogHeader.astro @@ -1,36 +1,3 @@ -<header class="layout"> - <article> - <h1> - <a href="/"> - <svg class="logo" width="32" height="32" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"> - <style> - #flame { - fill: #ff5d01; - } - #a { - fill: #000014; - } - </style> - <title>Logo</title> - <path - id="a" - fill-rule="evenodd" - clip-rule="evenodd" - d="M163.008 18.929c1.944 2.413 2.935 5.67 4.917 12.181l43.309 142.27a180.277 180.277 0 00-51.778-17.53l-28.198-95.29a3.67 3.67 0 00-7.042.01l-27.857 95.232a180.225 180.225 0 00-52.01 17.557l43.52-142.281c1.99-6.502 2.983-9.752 4.927-12.16a15.999 15.999 0 016.484-4.798c2.872-1.154 6.271-1.154 13.07-1.154h31.085c6.807 0 10.211 0 13.086 1.157a16.004 16.004 0 016.487 4.806z" - /> - <path - id="flame" - fill-rule="evenodd" - clip-rule="evenodd" - d="M168.19 180.151c-7.139 6.105-21.39 10.268-37.804 10.268-20.147 0-37.033-6.272-41.513-14.707-1.602 4.835-1.961 10.367-1.961 13.902 0 0-1.056 17.355 11.015 29.426 0-6.268 5.081-11.349 11.349-11.349 10.743 0 10.731 9.373 10.721 16.977v.679c0 11.542 7.054 21.436 17.086 25.606a23.27 23.27 0 01-2.339-10.2c0-11.008 6.463-15.107 13.974-19.87 5.976-3.79 12.616-8.001 17.192-16.449a31.024 31.024 0 003.743-14.82c0-3.299-.513-6.479-1.463-9.463z" - /> - </svg> - <span>My Blog</span> - </a> - </h1> - </article> -</header> - <style> header { padding-top: 1rem; @@ -88,3 +55,36 @@ h1 a { display: inline-flex; } </style> + +<header class="wrapper"> + <article> + <h1> + <a href="/"> + <svg class="logo" width="32" height="32" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"> + <style> + #flame { + fill: #ff5d01; + } + #a { + fill: #000014; + } + </style> + <title>Logo</title> + <path + id="a" + fill-rule="evenodd" + clip-rule="evenodd" + d="M163.008 18.929c1.944 2.413 2.935 5.67 4.917 12.181l43.309 142.27a180.277 180.277 0 00-51.778-17.53l-28.198-95.29a3.67 3.67 0 00-7.042.01l-27.857 95.232a180.225 180.225 0 00-52.01 17.557l43.52-142.281c1.99-6.502 2.983-9.752 4.927-12.16a15.999 15.999 0 016.484-4.798c2.872-1.154 6.271-1.154 13.07-1.154h31.085c6.807 0 10.211 0 13.086 1.157a16.004 16.004 0 016.487 4.806z" + /> + <path + id="flame" + fill-rule="evenodd" + clip-rule="evenodd" + d="M168.19 180.151c-7.139 6.105-21.39 10.268-37.804 10.268-20.147 0-37.033-6.272-41.513-14.707-1.602 4.835-1.961 10.367-1.961 13.902 0 0-1.056 17.355 11.015 29.426 0-6.268 5.081-11.349 11.349-11.349 10.743 0 10.731 9.373 10.721 16.977v.679c0 11.542 7.054 21.436 17.086 25.606a23.27 23.27 0 01-2.339-10.2c0-11.008 6.463-15.107 13.974-19.87 5.976-3.79 12.616-8.001 17.192-16.449a31.024 31.024 0 003.743-14.82c0-3.299-.513-6.479-1.463-9.463z" + /> + </svg> + <span>My Blog</span> + </a> + </h1> + </article> +</header> diff --git a/examples/blog/src/components/BlogPostPreview.astro b/examples/blog/src/components/BlogPostPreview.astro index 6a553366d..96d1190c7 100644 --- a/examples/blog/src/components/BlogPostPreview.astro +++ b/examples/blog/src/components/BlogPostPreview.astro @@ -26,13 +26,12 @@ const { post } = Astro.props; } header { + align-items: flex-start; display: flex; flex-direction: column; - text-align: left; - align-items: flex-start; justify-content: center; - padding-bottom: 2rem; + text-align: left; } .title, diff --git a/examples/blog/src/components/Heading.astro b/examples/blog/src/components/Heading.astro new file mode 100644 index 000000000..f1805aaf7 --- /dev/null +++ b/examples/blog/src/components/Heading.astro @@ -0,0 +1,9 @@ +<h1> + <slot/> +</h1> + +<style> + h1 { + color: red; + } +</style> diff --git a/examples/blog/src/layouts/BlogPost.astro b/examples/blog/src/layouts/BlogPost.astro index 76cb749d4..06bba074d 100644 --- a/examples/blog/src/layouts/BlogPost.astro +++ b/examples/blog/src/layouts/BlogPost.astro @@ -1,5 +1,4 @@ --- -import { Markdown } from 'astro/components'; import BaseHead from '../components/BaseHead.astro'; import BlogHeader from '../components/BlogHeader.astro'; import BlogPost from '../components/BlogPost.astro'; @@ -7,6 +6,7 @@ import BlogPost from '../components/BlogPost.astro'; const {content} = Astro.props; const {title, description, publishDate, author, heroImage, permalink, alt} = content; --- + <html lang={ content.lang || 'en' }> <head> <BaseHead title={title} description={description} permalink={permalink} /> @@ -15,9 +15,11 @@ const {title, description, publishDate, author, heroImage, permalink, alt} = con <body> <BlogHeader /> - <BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate} alt={alt}> - <slot /> - </BlogPost> + <div class="wrapper"> + <BlogPost title={title} author={author} heroImage={heroImage} publishDate={publishDate} alt={alt}> + <slot /> + </BlogPost> + </div> </body> </html> diff --git a/examples/blog/src/pages/index.astro b/examples/blog/src/pages/index.astro index 224e9db1d..f96f5e049 100644 --- a/examples/blog/src/pages/index.astro +++ b/examples/blog/src/pages/index.astro @@ -18,7 +18,7 @@ let permalink = 'https://example.com/'; // Data Fetching: List all Markdown posts in the repo. -let allPosts = Astro.fetchContent<MarkdownFrontmatter>('./posts/*.md'); +let allPosts = await Astro.fetchContent('./posts/*.md'); allPosts = allPosts.sort((a, b) => new Date(b.publishDate).valueOf() - new Date(a.publishDate).valueOf()); // Full Astro Component Syntax: @@ -30,14 +30,6 @@ allPosts = allPosts.sort((a, b) => new Date(b.publishDate).valueOf() - new Date( <link rel="stylesheet" href="/blog.css" /> <style> - body { - width: 100%; - display: grid; - grid-template-rows: 3.5rem 1fr; - --gutter: 0.5rem; - --doc-padding: 2rem; - } - header { width: 100%; height: 100%; @@ -75,7 +67,7 @@ allPosts = allPosts.sort((a, b) => new Date(b.publishDate).valueOf() - new Date( <body> <BlogHeader /> - <div class="layout"> + <div class="wrapper"> <main class="content"> <section class="intro"> <h1 class="latest">{title}</h1> diff --git a/examples/blog/src/pages/posts/index.md b/examples/blog/src/pages/posts/index.md new file mode 100644 index 000000000..949dfb866 --- /dev/null +++ b/examples/blog/src/pages/posts/index.md @@ -0,0 +1,16 @@ +--- +setup: | + import Layout from '../../layouts/BlogPost.astro' + import Cool from '../../components/Author.astro' +title: Hello world! +publishDate: 12 Sep 2021 +name: Nate Moore +value: 128 +description: Just a Hello World Post! +--- + +<Cool name={frontmatter.name} href="https://twitter.com/n_moore" client:load /> + +This is so cool! + +Do variables work {frontmatter.value * 2}? diff --git a/examples/blog/src/pages/posts/introducing-astro.md b/examples/blog/src/pages/posts/introducing-astro.md deleted file mode 100644 index 114161cd9..000000000 --- a/examples/blog/src/pages/posts/introducing-astro.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: 'Introducing Astro: Ship Less JavaScript' -description: "We're excited to announce Astro as a new way to build static websites and deliver lightning-fast performance without sacrificing a modern developer experience." -publishDate: 'Tuesday, June 8 2021' -author: 'fred' -heroImage: '/social.jpg' -alt: 'Astro' -layout: '../../layouts/BlogPost.astro' ---- - -There's a simple secret to building a faster website β _just ship less_. - -Unfortunately, modern web development has been trending in the opposite directionβtowards _more._ More JavaScript, more features, more moving parts, and ultimately more complexity needed to keep it all running smoothly. - -Today I'm excited to publicly share Astro: a new kind of static site builder that delivers lightning-fast performance with a modern developer experience. To design Astro, we borrowed the best parts of our favorite tools and then added a few innovations of our own, including: - -- **Bring Your Own Framework (BYOF):** Build your site using React, Svelte, Vue, Preact, web components, orΒ just plain ol' HTML + JavaScript. -- **100% Static HTML, No JS:** Astro renders your entire page to static HTML, removing all JavaScript from your final build by default. -- **On-Demand Components:** Need some JS? Astro can automatically hydrate interactive components when they become visible on the page. If the user never sees it, they never load it. -- **Fully-Featured:** Astro supports TypeScript, Scoped CSS, CSS Modules, Sass, Tailwind, Markdown, MDX, and any of your favorite npm packages. -- **SEO Enabled:** Automatic sitemaps, RSS feeds, pagination and collections take the pain out of SEO and syndication. - -This post marks the first public beta release of Astro. **Missing features and bugs are still to be expected at this early stage.** There are still some months to go before an official 1.0 release, but there are already several fast sites built with Astro in production today. We would love your early feedback as we move towards a v1.0 release later this year. - -> To learn more about Astro and start building your first site, check out [the project README.](https://github.com/snowpackjs/astro#-guides). - -## Getting Started - -Starting a new project in Astro is easy: - -```shell -# create your project -mkdir new-project-directory -cd new-project-directory -npm init astro - -# install your dependencies -npm install - -# start the dev server and open your browser -npm run dev -``` - -> To learn more about Astro and start building your first site, check out [the project README.](https://github.com/snowpackjs/astro#-guides). - -## How Astro Works - -Astro works a lot like a static site generator. If you have ever used Eleventy, Hugo, or Jekyll (or even a server-side web framework like Rails, Laravel, or Django) then you should feel right at home with Astro. - -In Astro, you compose your website using UI components from your favorite JavaScript web framework (React, Svelte, Vue, etc). Astro renders your entire site to static HTML during the build. The result is a fully static website with all JavaScript removed from the final page. No monolithic JavaScript application required, just static HTML that loads as fast as possible in the browser regardless of how many UI components you used to generate it. - -Of course, sometimes client-side JavaScript is inevitable. Image carousels, shopping carts, and auto-complete search bars are just a few examples of things that require some JavaScript to run in the browser. This is where Astro really shines: When a component needs some JavaScript, Astro only loads that one component (and any dependencies). The rest of your site continues to exist as static, lightweight HTML. - -In other full-stack web frameworks this level of per-component optimization would be impossible without loading the entire page in JavaScript, delaying interactivity. In Astro, this kind of [partial hydration](https://addyosmani.com/blog/rehydration/) is built into the tool itself. - -You can even [automatically defer components](https://codepen.io/jonneal/full/ZELvMvw) to only load once they become visible on the page with the `client:visible` directive. - -This new approach to web architecture is called [islands architecture](https://jasonformat.com/islands-architecture/). We didn't coin the term, but Astro may have perfected the technique. We are confident that an HTML-first, JavaScript-only-as-needed approach is the best solution for the majority of content-based websites. - -> To learn more about Astro and start building your first site, check out [the project README.](https://github.com/snowpackjs/astro#-guides) - -## Embracing the Pit of Success - -> A well-designed system makes it easy to do the right things and annoying (but not impossible) to do the wrong things<div class="source"><p>β Jeff Atwood</p>[Falling Into The Pit of Success](https://blog.codinghorror.com/falling-into-the-pit-of-success/)</div> - -Poor performance is often framed as a failure of the developer, but we respectfully disagree. In many cases, poor performance is a failure of tooling. It should be difficult to build a slow website. - -Astro's main design principle is to lead developers into what [Rico Mariani](https://twitter.com/ricomariani) dubbed "the pit of success". It is our goal to build every site "fast by default" while also delivering a familiar, modern developer experience. - -By building your site to static HTML by default, Astro makes it difficult (but never impossible π) to build a slow site. - -## Long-Term Sustainability - -Astro is built by the team of open source developers behind [Snowpack](https://snowpack.dev) and [Skypack](https://skypack.dev), with additional contributions from the community. - -**Astro is and always will be free.** It is an open source project released under the [MIT license](https://github.com/snowpackjs/astro/blob/main/LICENSE). - -We care deeply about building a more sustainable future for open source software. At the same time, we need to support Astro's development long-term. This requires money (donations alone aren't enough.) - -We're inspired by the early success of projects like [Tailwind](https://tailwindcss.com/), [Rome](https://rome.tools/), [Remix](https://remix.run/), [Ionic](https://ionicframework.com/), and others who are experimenting with long-term financial sustainability on top of Open Source. Over the next year we'll be exploring how we can create a sustainable business to support a 100% free, open source Astro for years to come. - -If your company is as excited about Astro as we are, [we'd love to hear from you.](https://astro.build/chat) - -Finally, I'd like to give a **HUGE** thanks to the 300+ developers who joined our earliest private beta. Your feedback has been essential in shaping Astro into the tool it is today. If you're interested in getting involved (or just following along with development) please [join us on Discord.](https://astro.build/chat) - -> To learn more about Astro and start building your first site, check out [the project README.](https://github.com/snowpackjs/astro#-guides) diff --git a/examples/docs/package.json b/examples/docs/package.json index bd1a861c0..acba905ee 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -14,15 +14,5 @@ "devDependencies": { "astro": "^0.20.12", "@snowpack/plugin-dotenv": "^2.1.0" - }, - "snowpack": { - "alias": { - "components": "./src/components", - "~": "./src" - }, - "plugins": [ - "@snowpack/plugin-dotenv" - ], - "workspaceRoot": "../.." } } diff --git a/examples/docs/src/components/HeadCommon.astro b/examples/docs/src/components/HeadCommon.astro index 83045c0d1..fded99bd4 100644 --- a/examples/docs/src/components/HeadCommon.astro +++ b/examples/docs/src/components/HeadCommon.astro @@ -1,4 +1,5 @@ <!-- Global Metadata --> +<meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link rel="icon" type="image/svg+xml" href="/favicon.svg" /> diff --git a/examples/docs/src/components/Header/Header.astro b/examples/docs/src/components/Header/Header.astro index a50957240..a6c82d7bb 100644 --- a/examples/docs/src/components/Header/Header.astro +++ b/examples/docs/src/components/Header/Header.astro @@ -4,8 +4,8 @@ import * as CONFIG from '../../config.ts'; import AstroLogo from './AstroLogo.astro'; import SkipToContent from './SkipToContent.astro'; import SidebarToggle from './SidebarToggle.tsx'; -import LanguageSelect from './LanguageSelect.jsx'; -import Search from "./Search.jsx"; +import LanguageSelect from './LanguageSelect.tsx'; +import Search from "./Search.tsx"; const {currentPage} = Astro.props; const lang = currentPage && getLanguageFromURL(currentPage); diff --git a/examples/docs/src/components/Header/Search.tsx b/examples/docs/src/components/Header/Search.tsx index 19ee513f1..158f6fe29 100644 --- a/examples/docs/src/components/Header/Search.tsx +++ b/examples/docs/src/components/Header/Search.tsx @@ -2,7 +2,7 @@ import { useState, useCallback, useRef } from 'react'; import { createPortal } from 'react-dom'; import { DocSearchModal, useDocSearchKeyboardEvents } from '@docsearch/react'; -import * as CONFIG from '../../config.js'; +import * as CONFIG from '../../config'; import '@docsearch/css/dist/style.css'; import './Search.css'; diff --git a/examples/docs/src/components/PageContent/PageContent.astro b/examples/docs/src/components/PageContent/PageContent.astro index fd1e9d242..4d904852a 100644 --- a/examples/docs/src/components/PageContent/PageContent.astro +++ b/examples/docs/src/components/PageContent/PageContent.astro @@ -1,9 +1,10 @@ --- +import MoreMenu from '../RightSidebar/MoreMenu.astro'; +import TableOfContents from '../RightSidebar/TableOfContents.tsx'; + const {content, githubEditUrl} = Astro.props; const title = content.title; const headers = content.astro.headers; -import MoreMenu from '../RightSidebar/MoreMenu.astro'; -import TableOfContents from '../RightSidebar/TableOfContents.tsx'; --- <style> .content { @@ -31,7 +32,7 @@ import TableOfContents from '../RightSidebar/TableOfContents.tsx'; <section class="main-section"> <h1 class="content-title" id="overview">{title}</h1> <nav class="block sm:hidden"> - <TableOfContents client:media="(max-width: 50em)" headers={headers}/> + <TableOfContents client:media="(max-width: 50em)" headers={headers} /> </nav> <slot /> </section> diff --git a/examples/docs/src/components/RightSidebar/MoreMenu.astro b/examples/docs/src/components/RightSidebar/MoreMenu.astro index c295d8933..c822aaee9 100644 --- a/examples/docs/src/components/RightSidebar/MoreMenu.astro +++ b/examples/docs/src/components/RightSidebar/MoreMenu.astro @@ -1,6 +1,6 @@ --- -import ThemeToggleButton from './ThemeToggleButton.jsx'; -import * as CONFIG from '../../config.js'; +import ThemeToggleButton from './ThemeToggleButton.tsx'; +import * as CONFIG from '../../config'; const {editHref} = Astro.props; const showMoreSection = (CONFIG.COMMUNITY_INVITE_URL || editHref); --- diff --git a/examples/docs/src/components/RightSidebar/RightSidebar.astro b/examples/docs/src/components/RightSidebar/RightSidebar.astro index ed1dd37cc..5e0a86b78 100644 --- a/examples/docs/src/components/RightSidebar/RightSidebar.astro +++ b/examples/docs/src/components/RightSidebar/RightSidebar.astro @@ -1,5 +1,5 @@ --- -import TableOfContents from './TableOfContents.jsx'; +import TableOfContents from './TableOfContents.tsx'; import MoreMenu from './MoreMenu.astro'; const {content, githubEditUrl} = Astro.props; const headers = content.astro.headers; diff --git a/examples/docs/src/languages.ts b/examples/docs/src/languages.ts index 389c3d7a7..5cdea0456 100644 --- a/examples/docs/src/languages.ts +++ b/examples/docs/src/languages.ts @@ -1,8 +1,10 @@ -import { KNOWN_LANGUAGES } from './config.js'; +import { KNOWN_LANGUAGES } from './config'; +export { KNOWN_LANGUAGES } export const KNOWN_LANGUAGE_CODES = Object.values(KNOWN_LANGUAGES); +export const langPathRegex = /\/([a-z]{2}-?[A-Z]{0,2})\//; export function getLanguageFromURL(pathname: string) { - const langCodeMatch = pathname.match(/\/([a-z]{2}-?[A-Z]{0,2})\//); + const langCodeMatch = pathname.match(langPathRegex); return langCodeMatch ? langCodeMatch[1] : 'en'; } diff --git a/examples/docs/src/layouts/MainLayout.astro b/examples/docs/src/layouts/MainLayout.astro index 620f2e06b..cdadebe61 100644 --- a/examples/docs/src/layouts/MainLayout.astro +++ b/examples/docs/src/layouts/MainLayout.astro @@ -6,7 +6,7 @@ import Footer from '../components/Footer/Footer.astro'; import PageContent from '../components/PageContent/PageContent.astro'; import LeftSidebar from '../components/LeftSidebar/LeftSidebar.astro'; import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; -import * as CONFIG from "../config.ts"; +import * as CONFIG from "../config"; const { content = {} } = Astro.props; const currentPage = Astro.request.url.pathname; @@ -14,7 +14,7 @@ const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.md`; const githubEditUrl = CONFIG.GITHUB_EDIT_URL && (CONFIG.GITHUB_EDIT_URL + currentFile); --- -<html dir="{content.dir ?? 'ltr'}" lang="{content.lang ?? 'en-us'}" class="initial"> +<html dir={content.dir ?? 'ltr'} lang={content.lang ?? 'en-us'} class="initial"> <head> <HeadCommon /> <HeadSEO {content} canonicalURL={Astro.request.canonicalURL} /> diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index b6552b8f4..bc0606cda 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -11,8 +11,5 @@ "devDependencies": { "@astrojs/renderer-lit": "^0.1.2", "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/framework-lit/src/pages/index.astro b/examples/framework-lit/src/pages/index.astro index 4c4ac5c10..ec4a7f73d 100644 --- a/examples/framework-lit/src/pages/index.astro +++ b/examples/framework-lit/src/pages/index.astro @@ -6,18 +6,14 @@ import '../components/Counter.js'; <!doctype html> <html lang="en"> -<head> - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - - <title>Demo</title> -</head> -<body> + <head> + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> + <title>Demo</title> + </head> + <body> <h1>Test app</h1> - <my-counter client:load /> - - <Lorem /> - + <Lorem /> <calc-add num={33} /> -</body> + </body> </html> diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 2c228a076..096e53977 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -9,10 +9,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.20.12", - "@astrojs/renderer-solid": "^0.1.1" - }, - "snowpack": { - "workspaceRoot": "../.." + "@astrojs/renderer-solid": "^0.1.1", + "astro": "^0.20.12" } } diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 493f037a8..fa472f48a 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/framework-preact/src/pages/index.astro b/examples/framework-preact/src/pages/index.astro index aea8b83a4..eefc24414 100644 --- a/examples/framework-preact/src/pages/index.astro +++ b/examples/framework-preact/src/pages/index.astro @@ -1,7 +1,6 @@ --- // Component Imports -import Counter from '../components/Counter.jsx' - +import Counter from '../components/Counter.tsx' // Full Astro Component Syntax: // https://docs.astro.build/core-concepts/astro-components/ @@ -9,13 +8,8 @@ import Counter from '../components/Counter.jsx' <html lang="en"> <head> <meta charset="utf-8" /> - <meta - name="viewport" - content="width=device-width" - /> - - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - + <meta name="viewport" content="width=device-width" /> + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <style> :global(:root) { font-family: system-ui; @@ -23,22 +17,22 @@ import Counter from '../components/Counter.jsx' } :global(.counter) { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 2em; + place-items: center; } :global(.children) { display: grid; - place-items: center; margin-bottom: 2em; + place-items: center; } </style> </head> <body> <main> <Counter client:visible> - <h1>Hello Preact!</h1> + <h1>Hello, Preact!</h1> </Counter> </main> </body> diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index 548557cb5..d83a8526d 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/framework-react/src/pages/index.astro b/examples/framework-react/src/pages/index.astro index b14489440..ba30fed6f 100644 --- a/examples/framework-react/src/pages/index.astro +++ b/examples/framework-react/src/pages/index.astro @@ -11,13 +11,8 @@ const someProps = { <html lang="en"> <head> <meta charset="utf-8" /> - <meta - name="viewport" - content="width=device-width" - /> - - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - + <meta name="viewport" content="width=device-width" /> + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <style> :global(:root) { font-family: system-ui; @@ -25,22 +20,22 @@ const someProps = { } :global(.counter) { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 2em; + place-items: center; } :global(.children) { display: grid; - place-items: center; margin-bottom: 2em; + place-items: center; } </style> </head> <body> <main> <Counter {...someProps} client:visible> - <h1>Hello React!</h1> + <h1>Hello, React!</h1> </Counter> </main> </body> diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 1d6b9a5b1..168455f9e 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -9,10 +9,7 @@ "preview": "astro preview" }, "devDependencies": { - "astro": "^0.20.12", - "@astrojs/renderer-solid": "0.1.1" - }, - "snowpack": { - "workspaceRoot": "../.." + "@astrojs/renderer-solid": "^0.1.1", + "astro": "^0.20.12" } } diff --git a/examples/framework-solid/src/components/Counter.jsx b/examples/framework-solid/src/components/Counter.jsx index 3d0b7e757..a008a709f 100644 --- a/examples/framework-solid/src/components/Counter.jsx +++ b/examples/framework-solid/src/components/Counter.jsx @@ -1,7 +1,6 @@ import { createSignal } from 'solid-js'; -/** */ -export default function SolidCounter({ children }) { +export default function Counter({ children }) { const [count, setCount] = createSignal(0); const add = () => setCount(count() + 1); const subtract = () => setCount(count() - 1); diff --git a/examples/framework-solid/src/pages/index.astro b/examples/framework-solid/src/pages/index.astro index 747385394..57369c320 100644 --- a/examples/framework-solid/src/pages/index.astro +++ b/examples/framework-solid/src/pages/index.astro @@ -1,7 +1,6 @@ --- import Counter from '../components/Counter.jsx'; --- - <html> <head> <meta charset="utf-8" /> @@ -13,10 +12,10 @@ import Counter from '../components/Counter.jsx'; } .counter { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 3em; + place-items: center; } .counter-message { text-align: center; diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index eae4ab4ab..b74b8416b 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/framework-svelte/src/pages/index.astro b/examples/framework-svelte/src/pages/index.astro index fa45d05e8..8cf84ef53 100644 --- a/examples/framework-svelte/src/pages/index.astro +++ b/examples/framework-svelte/src/pages/index.astro @@ -9,13 +9,8 @@ import Counter from '../components/Counter.svelte' <html lang="en"> <head> <meta charset="utf-8" /> - <meta - name="viewport" - content="width=device-width" - /> - - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - + <meta name="viewport" content="width=device-width" /> + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <style> :global(:root) { font-family: system-ui; @@ -23,22 +18,22 @@ import Counter from '../components/Counter.svelte' } :global(.counter) { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 2em; + place-items: center; } :global(.children) { display: grid; - place-items: center; margin-bottom: 2em; + place-items: center; } </style> </head> <body> <main> <Counter client:visible> - <h1>Hello Svelte!</h1> + <h1>Hello, Svelte!</h1> </Counter> </main> </body> diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 0e6732635..343f0a712 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/framework-vue/src/pages/index.astro b/examples/framework-vue/src/pages/index.astro index dbb1831b2..c7679c46e 100644 --- a/examples/framework-vue/src/pages/index.astro +++ b/examples/framework-vue/src/pages/index.astro @@ -9,13 +9,8 @@ import Counter from '../components/Counter.vue' <html lang="en"> <head> <meta charset="utf-8" /> - <meta - name="viewport" - content="width=device-width" - /> - - <link rel="icon" type="image/x-icon" href="/favicon.ico" /> - + <meta name="viewport" content="width=device-width" /> + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <style> :global(:root) { font-family: system-ui; @@ -23,22 +18,22 @@ import Counter from '../components/Counter.vue' } :global(.counter) { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - place-items: center; font-size: 2em; + grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 2em; + place-items: center; } :global(.children) { display: grid; - place-items: center; margin-bottom: 2em; + place-items: center; } </style> </head> <body> <main> <Counter client:visible> - <h1>Hello Vue!</h1> + <h1>Hello, Vue!</h1> </Counter> </main> </body> diff --git a/examples/minimal/package.json b/examples/minimal/package.json index c3a8588b6..f6d10c8af 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/minimal/src/pages/index.astro b/examples/minimal/src/pages/index.astro index 8e9209641..9def0d248 100644 --- a/examples/minimal/src/pages/index.astro +++ b/examples/minimal/src/pages/index.astro @@ -1,5 +1,6 @@ --- --- + <html lang="en"> <head> diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 49b222b20..8e3c39940 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/portfolio/src/components/MainHead.astro b/examples/portfolio/src/components/MainHead.astro index 74eb59164..166065fa8 100644 --- a/examples/portfolio/src/components/MainHead.astro +++ b/examples/portfolio/src/components/MainHead.astro @@ -8,6 +8,6 @@ const { title = 'Jeanine White: Personal Site', description = 'The personal site <title>{title}</title> <link rel="icon" type="image/x-icon" href="/favicon.ico" /> -<link rel="stylesheet" type="text/css" href="/_astro/src/scss/global.css"> +<link rel="stylesheet" type="text/css" href="/src/scss/global.scss"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;400;700;900&display=swap" rel="stylesheet"> diff --git a/examples/portfolio/src/pages/about.astro b/examples/portfolio/src/pages/about.astro index fd84c27da..36f4fe942 100644 --- a/examples/portfolio/src/pages/about.astro +++ b/examples/portfolio/src/pages/about.astro @@ -10,11 +10,12 @@ import Nav from '../components/Nav/index.jsx'; <MainHead title="About | Jeanine White" description="About Jeanine White Lorem Ipsum" /> <style lang="scss"> .heroImg { + max-height: 24rem; object-fit: cover; + overflow: hidden; img { width: 100%; - height: 100%; } } diff --git a/examples/portfolio/src/pages/index.astro b/examples/portfolio/src/pages/index.astro index 673ade234..5fbeea15a 100644 --- a/examples/portfolio/src/pages/index.astro +++ b/examples/portfolio/src/pages/index.astro @@ -7,7 +7,7 @@ import Footer from '../components/Footer/index.jsx'; import PortfolioPreview from '../components/PortfolioPreview/index.jsx'; // Data Fetching: List all Markdown posts in the repo. -const projects = Astro.fetchContent('./project/**/*.md'); +const projects = Astro.fetchContent("./project/**/*.md"); const featuredProject = projects[0]; // Full Astro Component Syntax: @@ -190,28 +190,19 @@ const featuredProject = projects[0]; height="1131" class="img" src="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75" - srcSet="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 800w, - https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 1200w, - https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1600&q=75 1600w, - https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=2400&q=75 2400w," + srcSet="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 800w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1200&q=75 1200w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=1600&q=75 1600w,https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?w=2400&q=75 2400w" sizes="(max-width: 800px) 800px, (max-width: 1200px) 1200px, (max-width: 1600px) 1600px, (max-width: 2400px) 2400px, 1200px" - /> - <div class="gradient" /> - <div class="gradient2" /> + > + <div class="gradient"></div> + <div class="gradient2"></div> <div class="overlay"> <h1 class="title"> <small class="subtitle">The personal site of </small>Jeanine White </h1> <div> - <span class="role"> - π©βπ» Developer <span class="invert">π©βπ» Developer</span> - </span> - <span class="role"> - π€ Speaker <span class="invert">π€ Speaker</span> - </span> - <span class="role"> - βοΈ Writer <span class="invert">βοΈ Writer</span> - </span> + <span class="role">π©βπ» Developer <span class="invert">π©βπ» Developer</span></span> + <span class="role">π€ Speaker <span class="invert">π€ Speaker</span></span> + <span class="role">βοΈ Writer <span class="invert">βοΈ Writer</span></span> </div> <p class="desc">Lover of dogs, roadtrips, and poetry.</p> </div> @@ -233,8 +224,7 @@ const featuredProject = projects[0]; <span>Hello!</span> Iβm Jeanine, and this is my website. It was made using{' '} <a href="https://github.com/snowpackjs/astro" target="_blank" rel="nofollow"> Astro - </a> - , a new way to build static sites. This is just an example template for you to modify. + </a>, a new way to build static sites. This is just an example template for you to modify. </p> <p> <a href="/about">Read more</a> diff --git a/examples/starter/package.json b/examples/starter/package.json index aceb6e548..95b369a27 100644 --- a/examples/starter/package.json +++ b/examples/starter/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/starter/src/components/Tour.astro b/examples/starter/src/components/Tour.astro index 71dbb74f2..bf4721f04 100644 --- a/examples/starter/src/components/Tour.astro +++ b/examples/starter/src/components/Tour.astro @@ -38,7 +38,7 @@ import { Markdown } from 'astro/components'; <h2>π Want to learn more?</h2> <p>Feel free to check <a href="https://github.com/snowpackjs/astro">our documentation</a> or jump into our <a href="https://astro.build/chat">Discord server</a>.</p> </section> - + </article> <style> diff --git a/examples/with-markdown-plugins/astro.config.mjs b/examples/with-markdown-plugins/astro.config.mjs index fa9d48a1b..a7a644944 100644 --- a/examples/with-markdown-plugins/astro.config.mjs +++ b/examples/with-markdown-plugins/astro.config.mjs @@ -5,16 +5,19 @@ // VSCode and other TypeScript-enabled text editors will provide auto-completion, // helpful tooltips, and warnings if your exported object is invalid. // You can disable this by removing "@ts-check" and `@type` comments below. +import astroRemark from '@astrojs/markdown-remark'; // @ts-check export default /** @type {import('astro').AstroUserConfig} */ ({ // Enable Custom Markdown options, plugins, etc. markdownOptions: { - remarkPlugins: ['remark-code-titles', 'remark-slug'], - rehypePlugins: [ - ['rehype-autolink-headings', { behavior: 'prepend' }], - ['rehype-toc', { headings: ['h2', 'h3'] }], - ['rehype-add-classes', { 'h1,h2,h3': 'title' }], - ], + render: [astroRemark, { + remarkPlugins: ['remark-code-titles', 'remark-slug'], + rehypePlugins: [ + ['rehype-autolink-headings', { behavior: 'prepend' }], + ['rehype-toc', { headings: ['h2', 'h3'] }], + ['rehype-add-classes', { 'h1,h2,h3': 'title' }], + ] + }] }, }); diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 21dd7ad8e..cec212962 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -15,8 +15,5 @@ "rehype-toc": "^3.0.2", "remark-code-titles": "^0.1.2", "remark-slug": "^6.0.0" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/with-markdown/package.json b/examples/with-markdown/package.json index 934f91436..2b83fe6e3 100644 --- a/examples/with-markdown/package.json +++ b/examples/with-markdown/package.json @@ -10,8 +10,5 @@ }, "devDependencies": { "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." } } diff --git a/examples/with-markdown/src/pages/index.astro b/examples/with-markdown/src/pages/index.astro index de6f32303..7249f07cd 100644 --- a/examples/with-markdown/src/pages/index.astro +++ b/examples/with-markdown/src/pages/index.astro @@ -44,9 +44,11 @@ const items = ['A', 'B', 'C']; ## Oh yeah... <ReactCounter client:visible> + π€― It's also _recursive_! ### Markdown can be embedded in any child component + </ReactCounter> ## Code diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 79db2295b..5146ac922 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -8,13 +8,11 @@ "build": "astro build", "preview": "astro preview" }, - "devDependencies": { - "astro": "^0.20.12" - }, "dependencies": { "nanostores": "^0.3.3" }, - "snowpack": { - "workspaceRoot": "../.." + "devDependencies": { + "@astrojs/renderer-solid": "^0.1.1", + "astro": "^0.20.12" } } diff --git a/examples/with-tailwindcss/astro.config.mjs b/examples/with-tailwindcss/astro.config.mjs index 878577d74..68499b3fa 100644 --- a/examples/with-tailwindcss/astro.config.mjs +++ b/examples/with-tailwindcss/astro.config.mjs @@ -8,10 +8,6 @@ // @ts-check export default /** @type {import('astro').AstroUserConfig} */ ({ - // Enable Tailwind by telling Astro where your Tailwind config file lives. - devOptions: { - tailwindConfig: './tailwind.config.js', - }, // Enable the Preact renderer to support Preact JSX components. renderers: ['@astrojs/renderer-preact'], }); diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 016c6bf57..0af749c58 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -9,10 +9,8 @@ "preview": "astro preview" }, "devDependencies": { - "tailwindcss": "^2.1.2", - "astro": "^0.20.12" - }, - "snowpack": { - "workspaceRoot": "../.." + "astro": "^0.20.12", + "autoprefixer": "^10.3.7", + "tailwindcss": "^2.2.17" } } diff --git a/examples/with-tailwindcss/postcss.config.js b/examples/with-tailwindcss/postcss.config.js new file mode 100644 index 000000000..12a703d90 --- /dev/null +++ b/examples/with-tailwindcss/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/examples/with-tailwindcss/tailwind.config.js b/examples/with-tailwindcss/tailwind.config.js index dc8c3ae87..e30b1f4de 100644 --- a/examples/with-tailwindcss/tailwind.config.js +++ b/examples/with-tailwindcss/tailwind.config.js @@ -1,4 +1,4 @@ module.exports = { mode: 'jit', - purge: ['./public/**/*.html', './src/**/*.{astro,js,jsx,ts,tsx,vue,svelte}'], + purge: ['**/*.{astro,html,js,jsx,svelte,ts,tsx,vue}'], }; |