Opened 7 years ago

Closed 5 years ago

#14977 closed task (wontfix)

allow for overriding theme name

Reported by: ben hockey Owned by:
Priority: undecided Milestone: tbd
Component: Dijit - LnF Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by ben hockey)

in https://github.com/cloudhead/less.js/commit/93b23d2c24936d5bd829ba1f725ef442e9475747 support was added that would make the following possible using lesscss:

@theme-name: claro;

~".@{theme-name}" .foo {
  color: blue;
}

will produce

.claro .foo {
  color: blue;
}

this would help towards providing a way for 2 versions of a theme to exist on a page at one time - or at least themes could be given alternate names. it wouldn't be a complete solution for having 2 versions but at least it gives some flexibility to developers.

the particular commit is not yet part of a tagged release of less and there are no tests covering this feature yet. i've opened a pull request that adds a regression test (https://github.com/cloudhead/less.js/pull/691). i'd say that we should at least wait for the next tagged release before we start using this and hopefully the regression test will be part of that release too.

at the same time, we may want to refactor our less files to follow this kind of nested structure:

// wrap the contents of the whole file with the theme-name
~".@{theme-name}" {
  .dijitCalendar {
    background-image: url("images/calendar.png"); // fallback for browsers that don't support CSS gradients

    .dj_ie6 & {
      background-image:none; // because on IE6 background-image overrides background-color
    }

    img {
      border: none;
    }

    // etc...

  }

  // etc...

}

Change History (3)

comment:1 Changed 7 years ago by ben hockey

Description: modified (diff)

comment:2 Changed 7 years ago by bill

Looks good to me. Of course we could also achieve the same functionality with a plain regex inside of compile.js, but might as well do it through less.

And I agree, probably it would make the files a little nicer to do the nesting.

comment:3 Changed 5 years ago by bill

Resolution: wontfix
Status: newclosed

In version two we aren't planning to have theme names (in the CSS files) at all. Each widget though will have it's own CSS files, which maybe achieves the same thing.

Note: See TracTickets for help on using tickets.