Skip to content

Commit

Permalink
Merge pull request #12 from kastigar/bec9cf7f4dabda233eff618f67b9fb32…
Browse files Browse the repository at this point in the history
…14a91a94

Pull-request fo issue #7
  • Loading branch information
softprops committed Feb 3, 2012
2 parents a7382af + bec9cf7 commit 17d7afb
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/resources/less-rhino-1.1.5.js
Expand Up @@ -2436,6 +2436,8 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
var sheetName = name.slice(0, name.lastIndexOf('/') + 1) + sheet.href;
var input = rshellGlobal.readFile(sheetName);
var parser = new less.Parser();
var savedName = name;
name = sheetName;
parser.parse(input, function (e, root) {
if (e) {
print("Error: " + e);
Expand All @@ -2444,6 +2446,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) {
callback(root, sheet, { local: false, lastModified: 0, remaining: remaining });
});

name = savedName;
// callback({}, sheet, { local: true, remaining: remaining });
}

Expand Down
20 changes: 20 additions & 0 deletions src/sbt-test/less-sbt/nested-imports/build.sbt
@@ -0,0 +1,20 @@
seq(lessSettings:_*)

(LessKeys.filter in (Compile, LessKeys.less)) := "main.less"

InputKey[Unit]("contents") <<= inputTask { (argsTask: TaskKey[Seq[String]]) =>
(argsTask, streams) map {
(args, out) =>
args match {
case Seq(given, expected) =>
if(IO.read(file(given)).trim.equals(IO.read(file(expected)).trim)) out.log.debug(
"Contents match"
)
else error(
"Contents of (%s)\n%s does not match (%s)\n%s" format(
given, IO.read(file(given)), expected, IO.read(file(expected))
)
)
}
}
}
6 changes: 6 additions & 0 deletions src/sbt-test/less-sbt/nested-imports/fixtures/main.css
@@ -0,0 +1,6 @@
h1 {
color: #001;
}
h2 {
color: #002;
}
1 change: 1 addition & 0 deletions src/sbt-test/less-sbt/nested-imports/project/plugins.sbt
@@ -0,0 +1 @@
addSbtPlugin("me.lessis" %% "less-sbt" % "0.1.5-SNAPSHOT")
@@ -0,0 +1 @@
@import "sub.less";
@@ -0,0 +1,3 @@
h1 {
color: #001;
}
2 changes: 2 additions & 0 deletions src/sbt-test/less-sbt/nested-imports/src/main/less/main.less
@@ -0,0 +1,2 @@
@import "imports/lib.less";
@import "sub.less";
3 changes: 3 additions & 0 deletions src/sbt-test/less-sbt/nested-imports/src/main/less/sub.less
@@ -0,0 +1,3 @@
h2 {
color: #002;
}
5 changes: 5 additions & 0 deletions src/sbt-test/less-sbt/nested-imports/test
@@ -0,0 +1,5 @@
# imported sub.less should be imported from imports/
> less
$ exists target/scala-2.9.1/resource_managed/main/css/main.css
# note: less expands shorthand hex, i.e. #eee -> #eeeeee
> contents target/scala-2.9.1/resource_managed/main/css/main.css fixtures/main.css

0 comments on commit 17d7afb

Please sign in to comment.