summaryrefslogtreecommitdiff
path: root/examples/subpath/src
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-11-15 10:33:51 -0500
committerGravatar GitHub <noreply@github.com> 2021-11-15 10:33:51 -0500
commitfca1a99dbdcc32aa130de29917629ad2fa397369 (patch)
tree9fd17a9afaec2a08f622209f1bea8ff158d38f91 /examples/subpath/src
parenta8b428ca27fd596bc331cdbb7a0388db1d052d55 (diff)
downloadastro-fca1a99dbdcc32aa130de29917629ad2fa397369.tar.gz
astro-fca1a99dbdcc32aa130de29917629ad2fa397369.tar.zst
astro-fca1a99dbdcc32aa130de29917629ad2fa397369.zip
Support for using a subpath (#1801)
* Support for using a subpath * Update the readme * Fix the package name * Adds a changeset * Ensure that public/ must be loaded from the subpath * Update preview to use the new paths * Use exact compiler version * Use the newest version * Use range again * Use newer range
Diffstat (limited to 'examples/subpath/src')
-rw-r--r--examples/subpath/src/components/Time.jsx7
-rw-r--r--examples/subpath/src/pages/index.astro32
-rw-r--r--examples/subpath/src/styles/main.scss5
3 files changed, 44 insertions, 0 deletions
diff --git a/examples/subpath/src/components/Time.jsx b/examples/subpath/src/components/Time.jsx
new file mode 100644
index 000000000..8172b77dd
--- /dev/null
+++ b/examples/subpath/src/components/Time.jsx
@@ -0,0 +1,7 @@
+import React from 'react';
+
+export default function() {
+ const date = new Date();
+ const format = new Intl.DateTimeFormat('en-US');
+ return <time>{format.format(date)}</time>
+} \ No newline at end of file
diff --git a/examples/subpath/src/pages/index.astro b/examples/subpath/src/pages/index.astro
new file mode 100644
index 000000000..b08f2e06f
--- /dev/null
+++ b/examples/subpath/src/pages/index.astro
@@ -0,0 +1,32 @@
+---
+import Time from '../components/Time.jsx'
+---
+
+<html lang="en">
+
+<head>
+ <meta charset="utf-8" />
+ <link rel="icon" type="image/x-icon" href="/favicon.ico" />
+ <link rel="stylesheet" href={Astro.resolve('../styles/main.scss')}>
+ <meta name="viewport" content="width=device-width" />
+ <title>Welcome to Astro</title>
+</head>
+
+<body>
+ <h1>Welcome to <a href="https://astro.build/">Astro</a></h1>
+
+ <main id="app">
+ Today: <Time client:idle />
+ </main>
+
+ <article>
+ <h2>Animals</h2>
+
+ <figure>
+ <img src="/blog/images/penguin.png" />
+ <figcaption>A penguin</figcaption>
+ </figure>
+ </article>
+</body>
+
+</html>
diff --git a/examples/subpath/src/styles/main.scss b/examples/subpath/src/styles/main.scss
new file mode 100644
index 000000000..573fc4396
--- /dev/null
+++ b/examples/subpath/src/styles/main.scss
@@ -0,0 +1,5 @@
+body {
+ #app {
+ color: tomato;
+ }
+} \ No newline at end of file