我无法使用资源插件获取 Grails 2.5.2 应用程序来处理对 CKEditor 所做的缓存破坏更改。资源插件配置如下:
grails.resources.adhoc.patterns = ['/js/*', '/images/*', '/css/*', '/plugins/*', '/thirdparty/*', '/templates/*']
grails.resources.adhoc.includes = ['/js/**', '/images/**', '/css/**', '/plugins/**', '/thirdparty/**', '/templates/**']
CKEditor 代码位于app-dir/web-app/thirdparty/ckeditor
并且当前版本为 4.5.9。缓存清除更改是在 4.5.5 中进行的,并且版本 4.5.4 与 grails 完美配合resources
。
使用 4.5.9 运行应用程序时,我在控制台中收到以下错误:
GET resource:/thirdparty/ckeditor/skins/moono/icons.png?t=a35abfe net::ERR_UNKNOWN_URL_SCHEME
似乎该resources
插件无法很好地处理 ckeditor 的 editor.css 文件中的值(应用程序提供的文件指向app-dir/thirdparty/ckeditor/skins/moono/editor.css?t=G4CD
as http://localhost:8080/app-dir/static/thirdparty/ckeditor/skins/moono/editor.css?t=G4CD
)。如果我直接查看这个文件,它包含以下图标.png 和 icons_hidpi.png 文件,表明resources
插件错误地将图像文件链接(实际上除了第一个)替换为“资源:/.. ." 不需要存在的 url,因此会出现控制台错误。奇怪的是,只有带有 t 参数的 icons.png 和 icons_hidpi.png 文件会以这种方式更改,同一editor.css
文件中的其他图像文件将被单独保留。
.cke_button__bold_icon {background: url(icons.png?t=a35abfe) no-repeat 0 -0px !important;}
.cke_button__italic_icon {background: url(resource:/thirdparty/ckeditor/skins/moono/icons.png?t=a35abfe) no-repeat 0 -24px !important;}
.cke_button__strike_icon {background: url(resource:/thirdparty/ckeditor/skins/moono/icons.png?t=a35abfe) no-repeat 0 -48px !important;}
.cke_button__subscript_icon {background: url(resource:/thirdparty/ckeditor/skins/moono/icons.png?t=a35abfe) no-repeat 0 -72px !important;}
如果我添加以下配置,应用程序将运行并完美显示。
grails.resources.processing.enabled = false
如果我使用
grails.resources.mappers.cssrewriter.excludes = ['/thirdparty/ckeditor/skins/moono/**']
为了防止resources
修改ckeditor's editor.css
文件,似乎没有任何改变。
我能做些什么?我不能在 4.5.4 离开 ckeditor,因为我正在尝试修复与它的交互。我已经在使用与另一篇文章中推荐的相同的配置,但这并不能解决问题。完全禁用 css 重写只会破坏其他插件。