Permalink
Browse files

fixed bug with reloading with resources > 1.0

  • Loading branch information...
paulfairless committed Feb 7, 2012
1 parent 82046ef commit 53c2380b65c964062dc764dd3319a02811d251f5
@@ -1,6 +1,6 @@
class LesscssResourcesGrailsPlugin {
// the plugin version
- def version = "1.0"
+ def version = "1.0.1"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.3.5 > *"
// the other plugins this plugin depends on
@@ -9,7 +9,8 @@ class LesscssResourcesGrailsPlugin {
// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/*.gsp",
- "web-app/less/*"
+ "web-app/less/*",
+ "web-app/images/*"
]
def author = "Paul Fairless"
@@ -21,4 +22,9 @@ This plugin supports server-side compilation of .less CSS files to their .css co
// URL to the plugin's documentation
def documentation = "https://github.com/paulfairless/grails-lesscss-resources"
+
+ def doWithSpring = { ->
+ org.grails.plugin.resource.CSSPreprocessorResourceMapper.defaultIncludes.add('**/*.less')
+ org.grails.plugin.resource.CSSRewriterResourceMapper.defaultIncludes.add('**/*.less')
+ }
}
@@ -39,7 +39,6 @@ class LesscssResourceMapper implements GrailsApplicationAware {
// Not sure if i really need these
resource.sourceUrlExtension = 'css'
resource.actualUrl = generateCompiledFileFromOriginal(resource.originalUrl)
- resource.sourceUrl = resource.actualUrl
resource.contentType = 'text/css'
resource.tagAttributes.rel = 'stylesheet'
} catch (LessException e) {
@@ -16,5 +16,8 @@ class LesscssBundleSpec extends GebSpec {
$('h1').jquery.css('color') == 'rgb(34, 34, 251)'
$('h2').jquery.css('color') == 'rgb(132, 34, 16)'
$('h3').jquery.css('color') == 'rgb(34, 251, 34)'
+
+ and:'css processor still runs'
+ $('h3').jquery.css('background-url') == 'images/header-pattern.png'
}
}
@@ -40,7 +40,7 @@ class LesscssResourceMapperTests extends GroovyTestCase{
play {
mockedMapper.map (resource, config)
assertEquals 'file_less.css', resource.actualUrl
- assertEquals 'file_less.css', resource.sourceUrl
+ assertEquals 'file.less', resource.sourceUrl
assertEquals 'css', resource.sourceUrlExtension
assertEquals 'stylesheet', resource.tagAttributes.rel
assertEquals 'text/css', resource.contentType
@@ -68,7 +68,7 @@ class LesscssResourceMapperTests extends GroovyTestCase{
play {
mockedMapper.map (resource, config)
assertEquals 'file_less.css', resource.actualUrl
- assertEquals 'file_less.css', resource.sourceUrl
+ assertEquals 'file.LESS', resource.sourceUrl
assertEquals 'css', resource.sourceUrlExtension
assertEquals 'stylesheet', resource.tagAttributes.rel
assertEquals 'text/css', resource.contentType
Binary file not shown.
View
@@ -7,6 +7,7 @@
h1 {
color: @blue;
+ background: url('../images/header-pattern.png');
}
h2 {

0 comments on commit 53c2380

Please sign in to comment.