-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
remove built-in AMP support #4710
Conversation
🦋 Changeset detectedLatest commit: 4c96bff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
cc @john-michael-murphy as I know this'll probably affect you lot |
Migration looks doable. Thank you for the heads up. AMP is such a thorn! |
There's no good way to do automatic service worker installation (the transformer can't read the config, or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having kit in the name kit-amp
seems a bit redundant. maybe just amp
?
originally i was thinking that we might end up having kit-specific stuff in there, but i'm inclined to do this just because my muscles are so used to |
Co-authored-by: Ben McCann <[email protected]>
This removes the
amp: true
config option in favour of a more appropriate solution (we despise AMP and want to hasten its demise, but still need to provide some way for people to deal with it).It adds a new
@sveltejs/kit/amp
module which exports atransform
function, which:<script>
tags<link rel="stylesheet">
elementsamp-custom
attribute to<style>
<meta http-equiv>
elementsadds<amp-install-serviceworker>
if appropriateSome of these are TODO and I haven't quite figured out how to solve them. Also TODO:
Using it is relatively straightforward — set
inlineStyleThreshold
toInfinity
(external stylesheets are disallowed), and add the following tosrc/hooks.js
:One thing we lose is the ability to exclude CSS from components that are imported but not rendered for a given page. Given AMP's wholly arbitrary CSS size limit, that can be a problem. This can be solved (at least for prerendered pages, where it doesn't matter how expensive this sort of processing is) with something like https://github.com/purifycss/purifycss:
It's not quite as turnkey as the current solution, but it's fine.
Another thing we lose is validation. This, too, can easily be solved in userland by using
amphtml-validator
directly.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpx changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0