question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not all "critical" CSS being included (Bootstrap v4 alpha 5)

See original GitHub issue

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 use critical, 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:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Error Encountered During Authorization</title>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
  <div class="container-fluid m-t-1">
    <div class="row">
      <div class="col-xs-5">
        <div class="card card-block">
          <h4 class="card-title">Error{{ if .Description }}: {{ .Title }}{{ end }}</h4>
          <h5>An error was encountered processing the authorization request:</h5>
          <p class="card-text">
            {{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}
          </p>
        </div> <!-- end card -->
      </div> <!-- end col-xs-5 -->
    </div> <!-- end row -->
 </div> <!-- end container-fluid -->
</body>
</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 to mt-1):

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Error Encountered During Authorization</title>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
  <div class="container-fluid mt-1">
    <div class="row">
      <div class="col-xs-5">
        <div class="card card-block">
          <h4 class="card-title">Error{{ if .Description }}: {{ .Title }}{{ end }}</h4>
          <h5>An error was encountered processing the authorization request:</h5>
          <p class="card-text">
            {{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}
          </p>
        </div> <!-- end card -->
      </div> <!-- end col-xs-5 -->
    </div> <!-- end row -->
 </div> <!-- end container-fluid -->
</body>
</html>

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?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:31 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
lukebusseycommented, Dec 13, 2016

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 _variables.scss file:

$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: stroke='#{$navbar-light-color}' which is compiled to: stroke='rgba(0,0,0,.5)'

Changing this to a solid hex color E.g. stroke='#7F7F7F' fixes the issue.

1reaction
pocketjosocommented, Dec 16, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap 4 Alpha 5
The Bootstrap Blog. News and announcements for all things Bootstrap, including new releases, Bootstrap Themes, and Bootstrap Icons.
Read more >
Bootstrap 4 not working with Angular 2 app - Stack Overflow
I suggest taking a look at ng-bootstrap. It is adapted to Angular and needs only the Bootstrap CSS, not the Javascript/jQuery code. –...
Read more >
Quick look at Bootstrap 4 (Alpha 5) - Slicejack
Bootstrap, the most popular HTML, CSS, and JS framework in the world ... and streamlining the looks, which means that it's not ready...
Read more >
Issues for Barrio Bootstrap 5 Theme | Drupal.org
Title Status Priority Category Mixins call unknown function svg‑load Closed (works as designed) Normal Support request Table Styling Bootstrap 5 Needs review Normal Support request subtheme...
Read more >
Bootstrap 5 alpha | Hacker News
Do you use the Django apps for Bootstrap or include it on your own? ... As another poster said with PurgeCSS it isn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found