1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/lib/plugin_registry.rb

59 lines
1.3 KiB
Ruby
Raw Normal View History

2016-05-10 16:50:01 +02:00
class PluginRegistry
class << self
attr_writer :javascripts
attr_writer :stylesheets
def asset_globs
@asset_globs ||= Set.new
end
def javascripts
@javascripts ||= Set.new
end
def stylesheets
@stylesheets ||= Set.new
end
def code_insertions
@code_insertions ||= {}
end
2016-05-10 16:50:01 +02:00
end
def self.register_glob(root, extension, options=nil)
self.asset_globs << [root, extension, options || {}]
end
def self.register_asset(asset, opts=nil)
if asset =~ /\.js$|\.js\.erb$|\.js\.es6$|\.coffee$|\.coffee\.erb/
# if opts == :admin
# self.admin_javascripts << asset
# else
# if opts == :server_side
# self.server_side_javascripts << asset
# end
self.javascripts << asset
# end
elsif asset =~ /\.css$|\.scss$/
# if opts == :mobile
# self.mobile_stylesheets << asset
# elsif opts == :desktop
# self.desktop_stylesheets << asset
# elsif opts == :variables
# self.sass_variables << asset
# else
self.stylesheets << asset
# end
# elsif asset =~ /\.hbs$/
# self.handlebars << asset
# elsif asset =~ /\.js\.handlebars$/
# self.handlebars << asset
end
2016-06-16 17:37:56 +02:00
end
2016-05-25 12:23:25 +02:00
2016-06-16 17:37:56 +02:00
def self.insert_code(key)
self.code_insertions[key]&.join('\n')
2016-05-10 16:50:01 +02:00
end
end