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

In lining CSS breaks styles. #295

Closed
JojokCreator opened this issue Jun 3, 2024 · 5 comments
Closed

In lining CSS breaks styles. #295

JojokCreator opened this issue Jun 3, 2024 · 5 comments
Assignees

Comments

@JojokCreator
Copy link

Hi, trying to use this amazing tool in a project. It works well for the most part but I have a few pages with embedded videos using https://astro-embed.netlify.app/components/youtube/ when I build and deploy the project the styles on the videos seem to get broken.

https://stackblitz.com/edit/withastro-astro-wsnvzt <-- example here.

To reproduce run npm run dev = styles are okay.

npm run preview (with the inlined css) = styles are broken.

@ebursztein
Copy link

Thanks

@NikolaRHristov
Copy link
Member

@JojokCreator I tried running it with:

npm install ; npm run build ; npm run preview

and styles are working correctly and they're inlined:

image

Am I missing something?

@JojokCreator
Copy link
Author

Hi, Thanks for looking into this. Open the page in a new tab and press play on the video.

image

It doesn't fill the container like it should, normally.

NikolaRHristov added a commit that referenced this issue Jul 24, 2024
@NikolaRHristov
Copy link
Member

NikolaRHristov commented Jul 24, 2024

Managed to reproduce. I think this is due to reduceInlineStyles https://github.com/GoogleChromeLabs/critters#properties

reduceInlineStyles [Boolean]

(https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) 
Option indicates if inline styles should be evaluated for critical CSS.

By default inline style tags will be evaluated and rewritten to only contain critical CSS.

Set it to false to skip processing inline styles. (default: true)
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
  integrations: [
    (await import('@playform/inline')).default({
      Critters: {
        reduceInlineStyles: false,
      },
    }),
  ],
});

should be working fine:

image

Somehow these styles get omitted because there's no active class on the component yet.

image

reduceInlineStyles

Will be disabled by default in the latest version.

@JojokCreator
Copy link
Author

JojokCreator commented Jul 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants