mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
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:
@ -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!
|
||||
|
Reference in New Issue
Block a user