简体   繁体   中英

Grails plugin packages images into the wrong folder

I have a plugin that has this path in web-apps : /images/icons/ . There are a few png files in there. When I run grails run-app on the plugin, they're accessible from http://localhost:8080/plugin/images/icons . However, when I include the plugin in a Grails app, they are now packaged into this url: http://localhost:8080/myapp/plugins/my-plugin-1.0.0/images/icons/sample.png .

Can someone explain what is going on here? I really want those assets accessible from /images/icons / not /plugins/plugin-version/images/icons .

The solution I found was to add the resource plugin back into Grails (along with the asset pipeline). This is how the image linking works now in my app:

<r:img dir="images" file="sample.png" plugin="myPlugin"/>

Note the plugin attribute. That's critical.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM