Class: Tonka::CSS
- Inherits:
-
Object
- Object
- Tonka::CSS
- Defined in:
- lib/tonka.rb
Instance Attribute Summary collapse
-
#layout ⇒ Object
CSS processing module.
-
#libraries ⇒ Object
CSS processing module.
-
#link_tag ⇒ Object
CSS processing module.
Class Method Summary collapse
Instance Method Summary collapse
- #generate_file(file_name) ⇒ Object
-
#initialize(file_name, options = []) ⇒ CSS
constructor
A new instance of CSS.
Constructor Details
#initialize(file_name, options = []) ⇒ CSS
Returns a new instance of CSS.
224 225 226 |
# File 'lib/tonka.rb', line 224 def initialize(file_name, =[]) @link_tag = generate_file(file_name) end |
Instance Attribute Details
#layout ⇒ Object
CSS processing module
216 217 218 |
# File 'lib/tonka.rb', line 216 def layout @layout end |
#libraries ⇒ Object
CSS processing module
216 217 218 |
# File 'lib/tonka.rb', line 216 def libraries @libraries end |
#link_tag ⇒ Object
CSS processing module
216 217 218 |
# File 'lib/tonka.rb', line 216 def link_tag @link_tag end |
Class Method Details
.libraries ⇒ Object
218 219 220 221 222 |
# File 'lib/tonka.rb', line 218 def self.libraries [ {"bootstrap" => "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"} ] end |
Instance Method Details
#generate_file(file_name) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/tonka.rb', line 228 def generate_file(file_name) css_file = File.new("#{$SITE_NAME}/stylesheets/#{file_name}.css","w") if file_name == "style" css_file_content = "/*INSERT CSS*/" else uri = '' Tonka::CSS.libraries.each do |library| uri = library[file_name] if library[file_name] end css_file_content = Net::HTTP.get(URI(uri)) end css_file.puts css_file_content css_file.close link_tag = "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheets/#{file_name}.css\" />" puts "\t\tbuilt ".green+"#{$SITE_NAME}/stylesheets/#{file_name}.css" return link_tag end |