Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Conversation

chriscorwin
Copy link
Contributor

This change is to achieve parity with fuelux, and is essentially identical to: ExactTarget/fuelux#1047

Purpose

The proposed change would allow us to begin to use the & parent selector that LESS provides more effectively.

Overview

The less build should be able to be slightly restructured so that the .fuelux wrapper class name is not in the parent-chain (&) during the main LESS compilation, and instead gets tacked onto the front of the rules after the fact.

The CSS file ultimately output ought not be any different after making this change, since the & selector currently goes under-utilized (due, of course, to the quirks of our current process).

Simple example

From the LESS documentation on Changing Selector Order.

Given the following code:

.header {
  .menu {
    border-radius: 5px;
    .no-borderradius & {
      background-image: url('images/button-background.png');
    }
  }
}

...the way we are currently building the LESS would render the .css as:

.fuelux .header .menu {
  border-radius: 5px;
}
.no-borderradius .fuelux .header .menu {
  background-image: url('images/button-background.png');
}

Note the stray .fuelux that is inserted after the .no-borderradius selector, which is not what the developer intended.

The restructure would output as:

.fuelux .header .menu {
  border-radius: 5px;
}
.fuelux .no-borderradius .header .menu {
  background-image: url('images/button-background.png');
}

The Actual Restructure Proposal

Introduces a new .less file at less/fuelux-override.less that does the initial compilation of the fuelux overrides not inside the .fuelux wrapper.

It outputs a temporary "non-namespaced" file, located at less/fuelux-override-no-namespace.less.

The fuelux-mctheme.less is changed so that it imports the less/fuelux-override-no-namespace.less file inside the wrapper -- tacking the .fuelux "namespace" onto the rules for the overrides.

// Fuel UX override
.fuelux {
    @import "fuelux-override-no-namespace.less";
}

The grunt task doing this outputs the resulting .css into it's final home at /dist/css/fuelux-mctheme.css, and then deletes the temporary file.

The temporary file is also added to .gitignore to ensure that a failed LESS build does not result in the temp file not being deleted and inadvertently checked into the repository.

Chris Corwin added 6 commits February 2, 2015 13:20
…-in-parents) restructured the less build to initially build the fuelux stuff without the .fuelux wrapper. it gets tacked onto the rules after the fact.
…-in-parents) updated .gigitnore to include fuelux-override-no-namespace.less
…-in-parents) set dist/css back to how it is in master
interactivellama added a commit that referenced this pull request Feb 9, 2015
…ld-to-allow-ampersand-to-not-have-fuelux-in-parents

Gh154   restructure less build to allow ampersand to not have fuelux in parents
@interactivellama interactivellama merged commit ef6a5c0 into ExactTarget:master Feb 9, 2015
@interactivellama interactivellama added this to the 1.4.0 milestone Feb 9, 2015
@chriscorwin chriscorwin deleted the GH154---restructure-less-build-to-allow-ampersand-to-not-have-fuelux-in-parents branch February 11, 2015 17:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants