Patch #31457

Add support for reloading plugin assets automatically in development mode

Added by Kouhei Sutou about 1 month ago. Updated 30 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Plugin API
Target version:4.1.0

Description

Redmine supports assets for plugin by putting files under plugins/*/assets/.
But Redmine doesn't support reloading (mirroring) plugin assets automatically.

For example, we need to restart bin/rails server process to apply changes when we change plugins/*/asserts/stylesheets/xxx.css.

I attach a path to support this.

add-support-for-auto-reloading-plugin-assets.diff Magnifier (996 Bytes) Kouhei Sutou, 2019-05-27 04:49

Associated revisions

Revision 18202
Added by Go MAEDA 30 days ago

Add support for reloading plugin assets automatically in development mode (#31457).

Patch by Kouhei Sutou.

History

#1 Updated by Go MAEDA about 1 month ago

  • Category set to Plugin API

Could you describe use cases for this feature? Since I am not familiar with plugin development, I cannot imagine why you want to update your plugins without restarting Redmine.

My concern for this feature is that it checks updates of assets on every HTTP requests and it may affect the performance of Redmine.

#2 Updated by Kouhei Sutou 30 days ago

Sure.

In Redmine itself development, we don't need to restart Redmine itself. It's useful. Because we don't need to follow the following steps:

  • Change public/stylesheets/application.css
  • Stop bin/rails server
  • Start bin/rails server again
  • Reload Web browser

We just need to do the following steps:

  • Change public/stylesheets/application.css
  • Reload Web browser

In the current Redmine plugin development, we need to follow the following steps for updating assets:

  • Change plugins/xxx/assets/xxx.css
  • Stop bin/rails server
  • Start bin/rails server again
  • Reload Web browser

In the current Redmine plugin development, we need to follow the following steps for updating codes:

  • Change plugins/xxx/app/models/xxx.rb
  • Reload Web browser

This patch allows Redmine plugin developers to follow the standard Rails application development style. i.e. We can use the following steps for plugin assets:

  • Change plugins/xxx/assets/xxx.css
  • Reload Web browser

My concern for this feature is that it checks updates of assets on every HTTP requests and it may affect the performance of Redmine.

In development mode, it may affect the performance of Redmine. But it's not in production mode.

Rails don't run update checks on production mode. See also:

#3 Updated by Kouhei Sutou 30 days ago

Ah, use case.
I want to improve style for [Full text search plugin](https://github.com/clear-code/redmine_full_text_search) by [CSS](https://github.com/clear-code/redmine_full_text_search/tree/master/assets/stylesheets). I want to check whether CSS change improves style without restarting Redmine. Restarting Redmine bother me because it's not the standard Rails application development style.

#4 Updated by Go MAEDA 30 days ago

  • Target version set to 4.1.0

Thank you for clarification. I understand that the change helps plugin developers a lot.

Setting the target version to 4.1.0.

#5 Updated by Go MAEDA 30 days ago

  • Status changed from New to Closed

Committed the patch. Thank you for improving Redmine.

#6 Updated by Go MAEDA 30 days ago

  • Subject changed from Add support for reloading plugin assets automatically to Add support for reloading plugin assets automatically in development mode

#7 Updated by Go MAEDA 30 days ago

  • Assignee set to Go MAEDA

Also available in: Atom PDF