When using automatic file includes (es6, hbs) from plugins, allow the

asset pipeline to find new and deleted files with deleting the `tmp`
folder and restarting the server.
This commit is contained in:
Robin Ward
2014-12-09 15:23:14 -05:00
parent 663cd93c6d
commit e76449d800
3 changed files with 35 additions and 23 deletions

View File

@ -26,19 +26,10 @@ class Plugin::Instance
@color_schemes = []
if @path
# Automatically include all ES6 JS files
dir = File.dirname(@path)
Dir.glob("#{dir}/assets/javascripts/**/*.js.es6") do |f|
relative = f.sub("#{dir}/assets/", "")
register_asset(relative)
end
# Automatically include all hbs files
Dir.glob("#{dir}/assets/javascripts/**/*.hbs") do |f|
relative = f.sub("#{dir}/assets/", "")
register_asset(relative)
end
# Automatically include all ES6 JS and hbs files
root_path = "#{File.dirname(@path)}/assets/javascripts"
DiscoursePluginRegistry.register_glob(root_path, 'js.es6')
DiscoursePluginRegistry.register_glob(root_path, 'hbs')
end
end