Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-HTML pages #2586

Merged
merged 8 commits into from
Feb 15, 2022
Merged

Support non-HTML pages #2586

merged 8 commits into from
Feb 15, 2022

Conversation

tony-sull
Copy link
Contributor

Changes

RFC 0006

This adds support for building non-HTML files from src/pages, hidden behind the --experimental-static-build flag

  • Built filenames/extensions follow the existing file-based routing behavior (src/pages/data.json.ts -> dist/data.json)
  • getStaticPaths() works to support dynamic routes

Testing

[x] supports static files, ex: src/pages/data.json.ts
[x] supports dynamic files, ex: src/pages/posts/[post].json.js
[x] these files are excluded from the sitemap
[x] works with astro dev
[x] ignored for the current scan-based build process

Docs

WIP: I still need to finish up docs for this feature and open a PR on the docs repo

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2022

🦋 Changeset detected

Latest commit: f244da1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) test labels Feb 15, 2022
.changeset/few-coats-warn.md Outdated Show resolved Hide resolved
@boehs
Copy link
Contributor

boehs commented Feb 15, 2022

Also, this is not the best place for this discussion but I wanted to start thoughts about extending this to the layouts directory. Currently, layouts are treated as components and the directory has no special meaning. This could change to

layouts/Main.astro also calls layouts/Main.svg.ts

RFC in draft

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nice tests too.

@tony-sull tony-sull merged commit d6d35bc into main Feb 15, 2022
@tony-sull tony-sull deleted the feat/endpoint-routes branch February 15, 2022 17:47
@github-actions github-actions bot mentioned this pull request Feb 15, 2022
@github-actions github-actions bot mentioned this pull request Feb 18, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* adds support for build non-html pages

* add non-html pages to the static build test suite

* adds getStaticPaths() test for non-html pages

* adds dev server tests for non-html pages

* ading a changeset

* updating changeset description

* testing for building non-html files with async data

* fixing typo in changeset docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants