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

Explicit build/serialization order for source CSS files required? #37

Closed
Bart76 opened this issue May 27, 2020 · 2 comments
Closed

Explicit build/serialization order for source CSS files required? #37

Bart76 opened this issue May 27, 2020 · 2 comments
Projects

Comments

@Bart76
Copy link

Bart76 commented May 27, 2020

Hello,

As a software developer, I am interested in using Cirrus within my company's internal projects and perhaps I might even contribute a few things in the near future. Even after intensively applying CSS in webdevelopment projects during the last two years, I still do not consider myself a CSS pro. I always like to learn new stuff and after all this time, CSS still keeps surprising me quite often.

During my first inspections of the Cirrus source code, I noticed a few noteworthy things, which I will attempt to address to you in the near future (if you don't mind). One of those things is the order in which the CSS files are serialized into the resulting "cirrus.css" output file. It seems that this ordering is alphabetical by file name.

As I have experienced in the past, the order in which CSS rules are defined is important regarding their related behavior. For example, look at the following sample code:

<style id="base-styling">
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    position: relative;
  }

  html, body {
    height: 100%;
  }
</style>

<style id="theme-styling">
  .first,
  .first * {
    background: red;
    border: 5px solid darkred;
  }

  .second,
  .second * {
    background: green;
    border: 5px solid darkgreen;
  }
</style>

<style id="initial-styling">
  div {
    width: 100%;
    height: 100%;
    padding: 20px;
  }

  .first {
    margin: 50px;
    width: 400px;
    height: 400px;
  }
</style>

<div class="first">
  <div class="second">
    <div class="third">
    </div>
  </div>
</div>

This code will render three nested squares. As it is now, the first (outer) square will be colored red and the second (middle) and third (innermost) squares will be colored green.

If the two CSS rules in the #theme-style element are switched, like this:...

<style id="theme-styling">
  .second,
  .second * {
    background: green;
    border: 5px solid darkgreen;
  }

  .first,
  .first * {
    background: red;
    border: 5px solid darkred;
  }
</style>

...the resulting CSS styling behavior will change dramatically: all three rectangles will now be colored red!

So, since the order of the defined CSS rules seems to be quite important to the resulting styling behavior, might it be useful to investigate the current deployment strategy in some more detail and specify an explicit build order of the various CSS source files (if it turns out to be necessary to do so)?

@Spiderpig86
Copy link
Owner

Hi,

Thanks for the input. The main part of the build file that handles build order is here. There used to be a specific order that was set, but I believe I removed it seeing no adverse effects in terms of ordering. This definitely needs to be investigated further if possible. Definitely I know that the default.css and theme.css should come before all else.

@Spiderpig86 Spiderpig86 added this to To do in 0.6.0 Jun 5, 2020
@Spiderpig86 Spiderpig86 moved this from To do to Punt in 0.6.0 Aug 11, 2020
@Spiderpig86
Copy link
Owner

The order in which different stylesheets are built is defined in all files defined in the builds directory here with 0.7.0. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.6.0
  
Punt
Development

No branches or pull requests

2 participants