nystudio107 / rollup-plugin-critical

Vite.js & Rollup plugin for generating critical CSS
MIT License
91 stars 11 forks source link

Results Generated Unrelated to URL #16

Open raray opened 11 months ago

raray commented 11 months ago

Question

I am highly confused about the results I am seeing. I've tried multiple different criticalUrl values. I've even used the exact example config from the docs. No matter what I put in, I get this CSS generated:

@charset "UTF-8";@import url(https://use.typekit.net/fbe6xqa.css);@font-face{font-family:AvenirNextVariable;src:url(/assets/fonts/AvenirNextVariableRoman.woff) format("woff-variations"),url(/assets/fonts/AvenirNextVariableRoman.woff2) format("woff2-variations");font-weight:400 900;font-stretch:75% 100%;font-style:normal;font-display:swap}@font-face{font-family:AvenirNextVariable;src:url(/assets/fonts/AvenirNextVariableItalic.woff) format("woff-variations"),url(/assets/fonts/AvenirNextVariableItalic.woff2) format("woff2-variations");font-weight:400 900;font-stretch:75% 100%;font-style:italic;font-display:swap}

Additional context

khalwat commented 11 months ago

Why are you generating Critical CSS from the nystudio107.com website?

raray commented 11 months ago

@khalwat I am trying to get any result that makes sense. As part of that effort, I tried multiple URLs including the one shown in the example docs.

I've tried multiple different criticalUrl values. I've even used the exact example config from the docs.

khalwat commented 11 months ago

The URL you should be pulling the Critical CSS from is your website's URL.

raray commented 11 months ago

Yes. I know. I've tried that. I always get the result above regardless of the URL I enter.

raray commented 11 months ago

The current config is this:

PluginCritical({
      criticalUrl: '[production url]',
      criticalBase: 'craft/web/assets/dist',
      criticalPages: [
        { uri: '', template: 'index' },
      ],
      criticalConfig: {
        user: '[production user]',
        pass: '[production pass]',
        strict: true,
      },
    }),
khalwat commented 11 months ago

Remove the password protection from your site and try again without it in the config? I've never tried it with that in there, so I'm unsure if it will work.

raray commented 11 months ago

I will try that, but I used multiple URLs that don't have passwords. Shouldn't I get a result from your website, or https://google.com which I also tried?

khalwat commented 11 months ago

Other URLs will not have CSS that matches yours, so you won't get any reasonable output

raray commented 11 months ago

I removed the password. No change.

I'm highly confused by your responses. Does Critical compare the scraped CSS against something else to generate its results?

khalwat commented 11 months ago

yes, it pulls the CSS from your Vite project

raray commented 11 months ago

I see, thanks. That was a clue. I switched everything to the staging environment which is a closer match to what I'm working with and it does seem to be trying to build something more significant. So much that it times out. I set the Penthouse timeout up to 5 minutes and it still timed out.