Search code examples
htmlreactjsreact-reduxnext.jsamp-html

AMP Validator Errors


I am new to next/amp, I am using amp with nextjs and in dev mode amp validator is throwing errors which I am unable to wrap my head around. Following are the errors that are being thrown:

  1. CSS syntax error in tag 'style amp-custom' - saw invalid at rule '@import'
  2. CSS syntax error in tag 'style amp-custom' - saw invalid at rule '@charset'

Solution

  • Yes. AMP has certain CSS code requirements. Your CSS code probably contains something like this:

    <style amp-custom>
      @charset "UTF-8";
      @import 'custom.css';
    </style>
    

    Just remove this code from: <style amp-custom></style>

    Read the official documentation: https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages/?format=websites