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

Pull-request fo issue #7 #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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