Created
December 1, 2011 02:31
-
-
Save metaskills/1412938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/less/rails/import_processor.rb b/lib/less/rails/import_processor.rb | |
index 23fcc2c..4b7f60a 100644 | |
--- a/lib/less/rails/import_processor.rb | |
+++ b/lib/less/rails/import_processor.rb | |
@@ -10,9 +10,13 @@ module Less | |
def evaluate(context, locals, &block) | |
import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq | |
import_paths.each do |path| | |
- asset = context.environment[path] | |
- if asset && asset.pathname.to_s.ends_with?('.less') | |
- context.depend_on_asset(asset.pathname) | |
+ pathname = begin | |
+ context.resolve(path) | |
+ rescue FileNotFound | |
+ nil | |
+ end | |
+ if pathname && pathname.to_s.ends_with?('.less') | |
+ context.depend_on(path) | |
end | |
end | |
data | |
diff --git a/test/dummy_app/app/assets/stylesheets/basics.css.less b/test/dummy_app/app/assets/stylesheets/basics.css.less | |
index b1cff20..7c2cd81 100644 | |
--- a/test/dummy_app/app/assets/stylesheets/basics.css.less | |
+++ b/test/dummy_app/app/assets/stylesheets/basics.css.less | |
@@ -10,5 +10,6 @@ | |
#test-mixin span { .bordered; } | |
// Frameworks | |
+@import "frameworks/bootstrap/variables"; | |
@import "frameworks/bootstrap/mixins"; | |
#test-radiused { .radiused; } | |
diff --git a/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less b/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less | |
index 2a5c3d7..d23d641 100644 | |
--- a/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less | |
+++ b/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less | |
@@ -2,3 +2,11 @@ | |
.radiused(@radius: 5px) { | |
border-radius: @radius; | |
} | |
+ | |
+.grayified() { | |
+ color: @gray; | |
+} | |
+ | |
+#test_grayified { | |
+ .grayified; | |
+} | |
diff --git a/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less b/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less | |
new file mode 100644 | |
index 0000000..c730a8a | |
--- /dev/null | |
+++ b/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less | |
@@ -0,0 +1 @@ | |
+@gray: #888888; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, when I tried this fix on a project I'm working, the rake assets:precompile task threw an exception:
I fixed this by replacing:
with:
at line 15. Hope this helps!