Patch #31457
closedAdd support for reloading plugin assets automatically in development mode
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.
Files
Related issues
Updated by Go MAEDA over 5 years 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.
Updated by Kouhei Sutou over 5 years 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:
Updated by Kouhei Sutou over 5 years 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.
Updated by Go MAEDA over 5 years 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.
Updated by Go MAEDA over 5 years ago
- Status changed from New to Closed
Committed the patch. Thank you for improving Redmine.
Updated by Go MAEDA over 5 years ago
- Subject changed from Add support for reloading plugin assets automatically to Add support for reloading plugin assets automatically in development mode
Updated by Go MAEDA almost 5 years ago
- Has duplicate Feature #11993: Reload plugin assets on every request in development mode added
Updated by Geo Tis over 4 years ago
- File chrome_XJsd7k5iS0.png chrome_XJsd7k5iS0.png added
Hi.
As soon as I update css and reload redmine page I got error. What I'm doing wrong?
Redmine version: 4.1.1
OS: Windows 10
Using
set RAILS_ENV=development bundle exec rails server webrick
As soon as I restart rails server - everything works fine.
Updated by Kouhei Sutou over 4 years ago
It's a problem of the redmine_issue_todo_lists plugin. It should not call unloadable
:
diff --git a/init.rb b/init.rb
index 3c354f4..17d8906 100644
--- a/init.rb
+++ b/init.rb
@@ -23,12 +23,7 @@ Redmine::Plugin.register :redmine_issue_todo_lists do
menu :project_menu, :issue_todo_lists, { :controller => 'issue_todo_lists', :action => 'index' }, :caption => :issue_todo_lists_title, :param => :project_id, :after => :activity
Rails.configuration.to_prepare do
- unless Project.included_modules.include? RedmineIssueTodoLists::ProjectPatch
- Project.send(:include, RedmineIssueTodoLists::ProjectPatch)
- end
-
- unless Issue.included_modules.include? RedmineIssueTodoLists::IssuePatch
- Issue.send(:include, RedmineIssueTodoLists::IssuePatch)
- end
+ Project.send(:include, RedmineIssueTodoLists::ProjectPatch)
+ Issue.send(:include, RedmineIssueTodoLists::IssuePatch)
end
end
diff --git a/lib/redmine_issue_todo_lists/issue_patch.rb b/lib/redmine_issue_todo_lists/issue_patch.rb
index 0f3cae8..5a925fa 100644
--- a/lib/redmine_issue_todo_lists/issue_patch.rb
+++ b/lib/redmine_issue_todo_lists/issue_patch.rb
@@ -5,8 +5,6 @@ module RedmineIssueTodoLists
base.send(:include, InstanceMethods)
base.class_eval do
- unloadable
-
after_save :remove_todo_list_allocations
has_many :issue_todo_list_items, dependent: :destroy
has_many :issue_todo_lists, through: :issue_todo_list_items
diff --git a/lib/redmine_issue_todo_lists/project_patch.rb b/lib/redmine_issue_todo_lists/project_patch.rb
index c12628c..012eb5e 100644
--- a/lib/redmine_issue_todo_lists/project_patch.rb
+++ b/lib/redmine_issue_todo_lists/project_patch.rb
@@ -5,8 +5,6 @@ module RedmineIssueTodoLists
base.send(:include, InstanceMethods)
base.class_eval do
- unloadable
-
has_many :issue_todo_lists, dependent: :destroy
end
end
Could you report this to the redmine_issue_todo_lists plugin?
Updated by Geo Tis over 4 years ago
Kouhei Sutou wrote:
It's a problem of the redmine_issue_todo_lists plugin. It should not call
unloadable
:[...]
Could you report this to the redmine_issue_todo_lists plugin?
Thank you for such quick reply.
Im developing own version based on original plugin for company needs, so will try to apply fix myself. Also will report it back to original developer.