class Middleman::WebComponents
Public Instance Methods
component_import_tag(*sources)
click to toggle source
# File lib/middleman-web_components.rb, line 20 def component_import_tag(*sources) extension = app.extensions[:web_components] options = { rel: 'import' }.update(sources.extract_options!.symbolize_keys) sources.flatten.inject(ActiveSupport::SafeBuffer.new) do |all, source| url = url_for(File.join('/', extension.options.directory, "#{source}.html")) all << tag(:link, {href: url}.update(options)) end end
manipulate_resource_list(resources)
click to toggle source
# File lib/middleman-web_components.rb, line 8 def manipulate_resource_list(resources) resources.collect do |resource| next resource if resource.ignored? next resource unless resource.path.start_with? options.directory content = `#{options.command} #{resource.source_file}` resource = Middleman::Sitemap::StringResource.new(app.sitemap, resource.path, content) resource.destination_path = Pathname(resource.path).sub_ext(options.suffix).to_path unless resource.ext == options.suffix resource end end