Class: Jekyll::Vite::Tag

Inherits:
Tags::IncludeTag
  • Object
show all
Includes:
Filters::URLFilters
Defined in:
lib/jekyll/vite/tags.rb

Overview

Internal: Base class for all tags.

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object

Override: Set the context to make the site available in the URLFilters.



8
9
10
11
12
13
14
15
16
# File 'lib/jekyll/vite/tags.rb', line 8

def render(context)
  @context = context
  @params = @params.is_a?(String) ? parse_params(context).transform_keys(&:to_sym) : @params || {}
  if @file = render_variable(@file)
    validate_file_name(@file)
    track_file_dependency(@file)
  end
  block_given? ? yield : raise(NotImplementedError, "Implement render in #{ self.class.name }")
end

#render_variable(variable) ⇒ Object

Override: Modified version that can resolve recursive references.



19
20
21
22
# File 'lib/jekyll/vite/tags.rb', line 19

def render_variable(variable)
  variable = Liquid::Template.parse(variable).render!(@context) while VARIABLE_SYNTAX =~ variable
  variable
end