如何将webjars与grails和资产管道一起使用
我正在尝试使用sass资产管道:2.9.4,它使用libsass而不是compass。然而,我的许多.scss文件使用libsass中不可用的mixin,因此我找到了一个webjar compass mixin,它有我想要的mixin 但是,资产管道找不到mixin,我得到一个如何将webjars与grails和资产管道一起使用,grails,asset-pipeline,compass,webjars,Grails,Asset Pipeline,Compass,Webjars,我正在尝试使用sass资产管道:2.9.4,它使用libsass而不是compass。然而,我的许多.scss文件使用libsass中不可用的mixin,因此我找到了一个webjar compass mixin,它有我想要的mixin 但是,资产管道找不到mixin,我得到一个错误asset.pipeline.jsass.sassetfileimporter-无法找到home.scss导入的compass的资产。当它尝试运行@import“compass”时,scss错误消息 我在导入过程中尝试
错误asset.pipeline.jsass.sassetfileimporter-无法找到home.scss导入的compass的资产。当它尝试运行@import“compass”时,scss
错误消息代码>
我在导入过程中尝试了不同的路径,因为资产管道说它可以与Webjar一起工作
如何获取@import“compass”代码>要工作吗?编辑:我的回答很愚蠢,根本不工作,很抱歉
仍在研究如何使compass与grails/sass协同工作,我最终得到了一个解决方案示例:
内建gradle
assets 'org.webjars.bower:compass-mixins:1.0.2'
bootRun {
dependsOn 'webjars resources extraction'
systemProperties = System.properties
}
task('webjars resources extraction', type: Copy) {
def jar = configurations.runtime.filter { it.name.contains('compass-mixins') }.first()
copy {
from zipTree(jar)
into "./grails-app/assets/stylesheets/vendor"
include 'META-INF/resources/webjars/compass-mixins/1.0.2/lib/**'
}
copy {
from "./grails-app/assets/stylesheets/vendor/META-INF/resources/webjars/compass-mixins/1.0.2/lib"
into "./grails-app/assets/stylesheets/vendor"
}
delete "grails-app/assets/stylesheets/vendor/META-INF"
}
assetClean {
delete 'grails-app/assets/stylesheets/vendor'
}
我还必须将.scss文件中的导入更改为:
@import "vendor/compass";
@import "vendor/compass/css3";
@Jeremy POUILLOT:您的解决方案似乎工作量减少了,尽管我注意到插件说它不再处于活动开发中,需要jruby进行开发。我最后用gradle任务将文件复制到grails应用程序下的assets/stylesheets/vendor文件夹中。它与最新的sass资产管道:2.9.4
一起工作吗?