# File lib/erector/widgets/external_renderer.rb, line 5 def content included_stylesheets if @included_stylesheets inline_styles if @inline_styles included_scripts if @included_scripts inline_scripts if @inline_scripts end
# File lib/erector/widgets/external_renderer.rb, line 18 def included_scripts rendered_externals(:js).each do |external| script({:type => "text/javascript", :src => external.text}.merge(external.options)) end end
# File lib/erector/widgets/external_renderer.rb, line 24 def included_stylesheets rendered_externals(:css).each do |external| link({:rel => "stylesheet", :href => external.text, :type => "text/css", :media => "all"}.merge(external.options)) end end
# File lib/erector/widgets/external_renderer.rb, line 46 def inline_scripts rendered_externals(:script).each do |external| javascript external.options do rawtext external.text end end # todo: allow :load or :ready per external script rendered_externals(:jquery).each do |external| jquery :load, external.text, external.options end end
# File lib/erector/widgets/external_renderer.rb, line 30 def inline_styles rendered_externals(:style).each do |external| style({:type => "text/css", 'xml:space' => 'preserve'}.merge(external.options)) do rawtext external.text end end if Object.const_defined?(:Sass) rendered_externals(:scss).each do |external| style({:type => "text/css", 'xml:space' => 'preserve'}.merge(external.options)) do rawtext Sass.compile(external.text) end end end end
# File lib/erector/widgets/external_renderer.rb, line 12 def rendered_externals(type) @classes.map do |klass| klass.dependencies(type) end.flatten.uniq end