Sha256: 3e1115265a32e4dff3245c539a64778f24853a90acdb09a3271917278c0e53b6
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# -*- coding: utf-8 -*- require 'turnip_formatter/template' require 'sass' module TurnipFormatter class Template class << self def project_name RSpec.configuration.respond_to?(:project_name) ? RSpec.configuration.project_name : 'Turnip' end def add_js(js_string) js_list << js_string end def add_js_file(file) if URI(file).scheme js_file_list << file else js_list << File.read(file) end end def add_scss(scss_string) css_list << Sass::Engine.new(scss_string, scss_option).render end def add_scss_file(path) css_list << Sass::Engine.for_file(path, scss_option).render end def js_render js_list.join("\n") end def js_file_render js_file_list.map do |file| "<script src=\"#{file}\" type=\"text/javascript\"></script>" end.join("\n") end def css_render css_list.join("\n") end def js_list @js_list ||= [] end def js_file_list @js_file_list ||= [] end def css_list @css_list ||= [] end def scss_option { syntax: :scss, style: :compressed } end end end end (File.dirname(__FILE__) + '/template').tap do |dirname| TurnipFormatter::Template.add_scss_file(dirname + '/turnip_formatter.scss') TurnipFormatter::Template.add_js_file(dirname + '/turnip_formatter.js') end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
turnip_formatter-0.2.8 | lib/turnip_formatter/template.rb |