#170 – The author stylesheet specified in tag 'style amp-custom' is too long

Posted in ‘weeblrAMP’
This is a public ticket. Everybody will be able to see its contents. Only enter usernames, passwords or any other sensitive information in the Private information field.
Tuesday, 13 August 2019 19:13 UTC
wdwprepschool
Hello,
I keep receiving this error - not on all pages, but about 350 pages are affected on my site:

The author stylesheet specified in tag 'style amp-custom' is too long - the limit is 50000 bytes.

Some URLs for testing are attached in the private area. Please let me know what we can do to fix this! Minification seemed to work, but that's not ideal for maintaining CSS :-(


Thank you!
Wednesday, 14 August 2019 07:24 UTC
wb_weeblrpress
Hi

Please let me know what we can do to fix this!
Have less CSS! Unfortunately, there's not much that can be done about the CSS size limit, that's just what the AMP specification says.

Minification is the way to go in all cases. You can have 2 versions of your CSS, develop with the non-minified and then apply a minifier on the CSS and use the output for the AMP page.

Another thing to look at is splitting the CSS: you may have some CSS that only applies to some pages. If so, you can split the CSS in several shorter versions. Then instead of adding your custom CSS directly inside of weeblrAMP settings, you can instead inject it with a filter (search for weeblramp_theme_css filter in the hooks documentation).
In your filter you can then only add the CSS required by the current page, for instance based on the page template as you did in another of your ticket.

Best regards
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.