-
Notifications
You must be signed in to change notification settings - Fork 372
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
Not all "critical" CSS being included (Bootstrap v4 alpha 5) #181
Comments
Sorry, forgot to mention that this causes a "flash of unstyled content" on the v5 version prior to the maxcdn css being retrieved. |
Not sure if this is helpful or not, but I also just checked the bootstrap v4 alpha 3 and alpha 4, and they include the correct classes. |
.. although I notice that what you've posted is not |
I can confirm that something causes the |
So it's an issue with the minified bootstrap css and the AST parser Penthouse uses (this one, you can see the problem here: http://iamdustan.com/reworkcss_ast_explorer/#/e8Tdpm7KWq/1 The @kenshaw : Hmm. If you were using @bezoerb and other Since |
Thanks for the quick response. I can confirm that using the non-minified version of Bootstrap makes this issue go away. Really confusing though, but I really appreciate you guys working on this! Many thanks! |
I'm running into the same issue, but because of my particular build process, I can't unminify the CSS beforehand. The parsing issue is caused by this line in Bootstrap's $navbar-light-toggler-bg: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='#{$navbar-light-color}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E"); The part causing the problem is the stroke color: Changing this to a solid hex color E.g. |
Great find @lukebussey |
Tbh i have no clue where to start on this issue :[ Furthermore with quick fix from @lukebussey it appears latest v1+ critical extracts only navbar components for me. This results in too less CSS being inlined for my project. Too bad I had to revert to v0.8.4. |
This (incorrect parsing of original css, especially when containing errors) has been resolved in the latest (1.2) version of Penthouse - https://github.com/pocketjoso/penthouse/releases/tag/v1.2.0. @bezoerb @addyosmani Would be great to see an upgrade pushed out. |
@lukebussey It appears latest penthouse doesn't need this bootstrap hack any more. Miserably, there is still some CSS missing for my critical gulp task. @pocketjoso I have no idea where to look. Do you have any idea what is wrong with my critical task config? Thanks in advance! https://github.com/midzer/eisolzried/blob/master/_tasks/critical.js |
@midzer The online generator is on the latest penthouse version - critical is not. I presume this is the culprit. With the latest penthouse version no more hacks are needed to get around CSS parsing issues. Friendly ping @bezoerb for a release update - did you try the latest Penthouse version (1.3, although the majority of Penthouse became fault tolerant in 1,2)? If you encountered any issues, please let me know. If there was just no time available to test it yet then I fully understand! |
@pocketjoso in my build environment |
Thanks for the ping @pocketjoso :) |
Thanks for the update!
…On Mon, Jan 8, 2018 at 11:24 PM, Ben Zörb ***@***.***> wrote:
Thanks for the ping @pocketjoso <https://github.com/pocketjoso> :)
I already worked on the dependency update in the bump-dependencies
<https://github.com/addyosmani/critical/tree/bump-dependencies> branch.
Unfortunately i'm randomly running in some ECONNRESET errors
<https://travis-ci.org/addyosmani/critical/builds/319980576> and i
haven't yet figured out what's causing them.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#181 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG3BANdB41k7QF_Yy1x1_PnBuQDk4pTBks5tIpWPgaJpZM4LDOg_>
.
|
Bumping this one as css generated from latest critical still differs from css generated from https://jonassebastianohlsson.com/criticalpathcssgenerator/ My critical config:
Site: https://feuerwehr-eisolzried.de/ |
@midzer Critical is currently using the latest version pf Penthouse, just as my online generator. Hence if you have a difference it should be related to the input - that critical for some reason is not seeing the original css containing these styles. Are these styles coming from a separate source than the ones that are kept? |
@pocketjoso Thx for your reply |
Hmm but then you really should get the same critical styles from critical
as from the online generator. Are you sure these styles are critical -
shown in the critical viewing for the first render (before js)?
Le sam. 31 mars 2018 21:23, midzer <[email protected]> a écrit :
… @pocketjoso <https://github.com/pocketjoso> Thx for your reply
All styles are located in main.min.css. Specifying this file in css
parameter makes no difference either.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#181 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG3BAFV1lnSzWuNZfMr417YGaQtkKOD7ks5tj9e-gaJpZM4LDOg_>
.
|
I really don't know whats going on there :\ Here's a diff between online generator css (left) and inlined critical css (right) using before stated settings https://www.diffchecker.com/ysBsWWiz |
@midzer Tip: the comparison is much easier to understand if your unminify the css first. So it looks to me that somehow you are feeding the wrong html/url into critical. That would explain why the page it is looking at is not what you think it is, not containing the content you think, and hence why you get a different critical css. So can you double check your critical setup, and maybe try with a completely different url? I suspect this is the problem on your end. |
@midzer: I completely agree with @pocketjoso critical https://feuerwehr-eisolzried.de I get the same results without anything missing. |
First of all thx again for your help @pocketjoso and @bezoerb I figured out whats going on! Finally using local production build critical css is being fully generated same as via online gerator or critical cli + url. Right now there's a caveat though. It's only fully generated if I specify
in HTML
But I need this beginning After digging in some related issues I tried to specify |
Update to previous post: If some1 has time to help me out on this issue, would be really awesome. |
@midzer: sorry for the late response. Maybe you could check if this update solves your issue? |
@midzer I can confirm this is still an issue. I'm able to generate critical css inline perfectly, but only when the path to your main css file is relative:
...which makes it really difficult to try to use this for anything other than your home page. |
@MindSculpt: can you provide a gist or something else to reproduce the issue? |
@bezoerb That might be tough, as critical is built into my custom static website generator which is not part of a public repo. When I use an absolute path to my stylesheet, critical starts up but then stops suddenly before grabbing the rest of the styles needed, so I wind up with FOUC because the inlined styles aren't complete. I am using Bootstrap 4 in this build (which relates to one of the issues above). I am also running critical from a gulp task that's not in the root of my project, so I'm not sure if that's part of it. I am using In previous projects, critical worked fine with Bootstrap 3, so I don't know if it's a BS4 issue or not. |
I tried to reproduce this behavior but everything works just as expected when i use Bootstrap 4. If anyone can provide something to reproduce this issue leave me a note ;) |
Works also fine here for my own projects. If this is still an issue please make a new issue with all a minimal reproducible example included (package.json and everything). |
My apologies in advance if this is not a
critical
issue, if I am posting this in the wrong place, if this is due to my misunderstanding of how to usecritical
, or if this is is instead a bootstrap problem.Using the latest version of
critical
, v0.8.1, and using Bootstrap v4 alpha 2 in this HTML:And running
critical
like the following:critical ae_bs4_a2.html --inline > ae_bs4_a2.out.html
Will correctly include the '.card' CSS selector. However, with Bootstrap v4 alpha 5 and this html (note, the only changes are the CDN location, and the
m-t-1
class name was changed tomt-1
):And running critical like the following:
critical ae_bs4_a5.html --inline > ae_bs4_a5.out.html
Will produce inline'd css that DOES NOT include the
.card
classes (and others).Is this a
critical
issue, or am I doing something incorrect here?The text was updated successfully, but these errors were encountered: