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

Charset directive is not at top #2126

Closed
Taritsyn opened this issue Jul 28, 2014 · 4 comments · Fixed by #2135
Closed

Charset directive is not at top #2126

Taritsyn opened this issue Jul 28, 2014 · 4 comments · Fixed by #2135

Comments

@Taritsyn
Copy link
Contributor

When compile the following code:

test.less:

.icon {
    float: left;
    margin: 3px;
    padding: 0;
    width: 16px;
    height: 16px;
    background: transparent url('0.gif') no-repeat;
}

@import "import1.css";
@import "import2.less";

import1.css:

.icon-abacus {
    background-image: url("abacus.png");
}

import2.less:

@charset "UTF-8";

.icon-cactus {
    background-image: url('cactus.png');
}

Get the following result:

@import "import1.css";
@charset "UTF-8";
.icon {
  float: left;
  margin: 3px;
  padding: 0;
  width: 16px;
  height: 16px;
  background: transparent url('0.gif') no-repeat;
}
.icon-cactus {
  background-image: url('cactus.png');
}
@seven-phases-max
Copy link
Member

See #2013. Fixed in 1.7.4

@seven-phases-max
Copy link
Member

Closing as duplicate of #2013.

@SomMeri
Copy link
Member

SomMeri commented Jul 28, 2014

It is not really a duplicate of that. #2013 prevents @import directive to float higher then @charset. Current master will keep the order of @import and @charset directives as they have been defined in sheets. This one more of a feature request to sort directives and fix their order if the defined one is wrong.

In any case, sorting should be just a very small fix.

@SomMeri SomMeri reopened this Jul 28, 2014
SomMeri pushed a commit to SomMeri/less-rhino.js that referenced this issue Aug 3, 2014
lukeapage added a commit that referenced this issue Aug 14, 2014
@matthew-dean
Copy link
Member

I just discovered this. Note that the solution bubbles @charset to the top, which is fine, but allows @charset to be defined anywhere in a Less stylesheet, which IMO should result in an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants