The author stylesheet specified in tag script is too long - document contains 21759 bytes whereas the limit is 10000 bytes


Amp Validation Error: The author stylesheet specified in tag 'script' is too long - document contains 21759 bytes whereas the limit is 10000 bytes.

If you are trying to validate your AMP HTML webpage and you see the above validation error that it means that you have exceeded the set limit that a javaScript amp-script code you can have for a page.

amp-script is the way you can run JavaScript on AMP-enabled webpages, but there is a set limit,

amp-script has the following restrictions on JavaScript file size:

Maximum of 10,000 bytes per amp-script element that uses a local script via script[type=text/plain][target=amp-script]. Maximum total of 150,000 bytes for all amp-script elements on the page.

Source: https://amp.dev/documentation/components/amp-script/#faq

Ways to resolve this error,
  1. You need to remove unwanted javaScript code, try and re-write your code to make it fit 10000 bytes. If you are external libraries like bootstrap or any other UI framework, you may have to avoid it - or use alternatives.
  2. You can minify your JavaScript and CSS code - this really helps.
Advertisements
Try Out Code2care Dev Tools:

Advertisements



Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency