FEATURE: split JavaScript application bundle, so plugins live in own file

This adds plugin.js and plugin_third_party.js files
This commit is contained in:
Sam
2016-11-15 11:42:55 +11:00
parent 67edb6ce5c
commit f4c754b389
11 changed files with 141 additions and 23 deletions

View File

@ -393,6 +393,37 @@ JS
end
end
def handlebars_includes
assets.map do |asset, opts|
next if opts == :admin
next unless asset =~ DiscoursePluginRegistry::HANDLEBARS_REGEX
asset
end.compact
end
def javascript_includes
assets.map do |asset, opts|
next if opts == :admin
next unless asset =~ DiscoursePluginRegistry::JS_REGEX
asset
end.compact
end
def each_globbed_asset
if @path
# Automatically include all ES6 JS and hbs files
root_path = "#{File.dirname(@path)}/assets/javascripts"
Dir.glob("#{root_path}/**/*") do |f|
if File.directory?(f)
yield [f,true]
elsif f.to_s.ends_with?(".js.es6") || f.to_s.ends_with?(".hbs")
yield [f,false]
end
end
end
end
protected
def register_assets!