Class: JqueryMobileTheme
- Inherits:
-
Object
- Object
- JqueryMobileTheme
- Defined in:
- lib/jquery_mobile_theme.rb
Instance Method Summary collapse
-
#convert_theme(name, dir, stylesheets) ⇒ Object
Create a sass file of variables names and copy the images.
-
#initialize(base_theme_directory) ⇒ JqueryMobileTheme
constructor
Initialize with the base theme.
Constructor Details
#initialize(base_theme_directory) ⇒ JqueryMobileTheme
Initialize with the base theme
7 8 9 10 |
# File 'lib/jquery_mobile_theme.rb', line 7 def initialize(base_theme_directory) @prefix = 'jquery.mobile' @theme_filename = "#{@prefix}.theme.css" end |
Instance Method Details
#convert_theme(name, dir, stylesheets) ⇒ Object
Create a sass file of variables names and copy the images
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jquery_mobile_theme.rb', line 13 def convert_theme(name, dir, stylesheets) theme = File.read(File.join(dir, @theme_filename)) # Fix stuff theme.gsub!(/\;filter:Alpha/, "; filter: Alpha") theme.gsub! /url\(images(.+?)\)/, "image_url(\"jquery/mobile/#{name}\\1\")" # Convert the stylesheet open File.join(MOBILE_DEST_THEMES, "#{name}.scss"), 'w' do |f| sass = MOBILE_MESSAGE2 IO.popen("sass-convert -F css -T scss", 'r+') { |ff| ff.print(theme); ff.close_write; sass += ff.read } f.print sass f.print "\n@import \"jquery/mobile/_base\"\n" end end |