lib/roda/plugins/assets.rb in roda-3.30.0 vs lib/roda/plugins/assets.rb in roda-3.31.0
- old
+ new
@@ -323,14 +323,18 @@
# Internal exception raised when a compressor cannot be found
CompressorNotFound = Class.new(RodaError)
# Load the render, caching, and h plugins, since the assets plugin
# depends on them.
- def self.load_dependencies(app, _opts = nil)
+ def self.load_dependencies(app, opts = OPTS)
app.plugin :render
app.plugin :caching
app.plugin :h
+
+ if opts[:relative_paths]
+ app.plugin :relative_path
+ end
end
# Setup the options for the plugin. See the Assets module RDoc
# for a description of the supported options.
def self.configure(app, opts = {})
@@ -645,13 +649,12 @@
end
"#{url_prefix}/#{o[:"#{stype}_prefix"]}#{mtime}#{prefix}#{f}#{o[:"#{stype}_suffix"]}"
end
end
- if relative_paths && (slash_count = request.path.count('/')) >= 1
- relative_prefix = "../" * (slash_count - 1)
+ if relative_paths
paths.map! do |path|
- "#{relative_prefix}#{path.slice(1,100000000)}"
+ "#{relative_prefix}#{path}"
end
end
paths
end