less-expander 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "less-expander"
5
+ gemspec.summary = "Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties."
6
+ gemspec.description = "Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties."
7
+ gemspec.email = "jeremy@jeremyboles.com"
8
+ gemspec.homepage = "http://github.com/jeremyboles/less-expander"
9
+ gemspec.authors = ["Jeremy Boles"]
10
+ gemspec.files.exclude '.DS_Store', '.gitignore'
11
+ gemspec.add_dependency('less', '>= 1.2.21')
12
+ end
13
+ rescue LoadError
14
+ puts "Jeweler not available. Install it with: gem install jeweler"
15
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
data/bin/lessc ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.dirname(__FILE__) + "/../lib"
4
+
5
+ require 'optparse'
6
+ require 'rubygems'
7
+ require 'less'
8
+ require 'less/expander'
9
+
10
+ begin
11
+ require 'growl'
12
+ rescue LoadError
13
+ Less::GROWL = false
14
+ else
15
+ Less::GROWL = true
16
+ end
17
+
18
+ # Argument defaults
19
+ options = {
20
+ :watch => false,
21
+ :compress => false,
22
+ :debug => false,
23
+ :growl => false,
24
+ :timestamps => false,
25
+ :color => $stdout.tty?
26
+ }
27
+
28
+ # Get arguments
29
+ opts = OptionParser.new do |o|
30
+ o.banner = "usage: lessc source [destination] [--watch]"
31
+ o.separator ""
32
+
33
+ # Watch mode
34
+ o.on("-w", "--watch", "watch for changes") do
35
+ options[:watch] = true
36
+ end
37
+
38
+ # Growl
39
+ o.on("-g", "--growl", "growl notifications") do
40
+ if Less::GROWL && (Growl.installed? rescue false)
41
+ options[:growl] = true
42
+ elsif Less::GROWL
43
+ abort "Growl or 'growlnotify' wasn't found on your system."
44
+ else
45
+ abort "Growl gem not found, please install with: " +
46
+ "`sudo gem install visionmedia-growl -s http://gems.github.com`"
47
+ end
48
+ end
49
+
50
+ # Timestamps
51
+ o.on("-t", "--timestamps", "show timestamps in watch mode") do
52
+ options[:timestamps] = true
53
+ end
54
+
55
+ # No color in output
56
+ o.on("--no-color", "suppress color in output") do
57
+ options[:color] = false
58
+ end
59
+
60
+ o.on('--verbose', 'show success messages when using growl') do
61
+ options[:verbose] = true
62
+ end
63
+
64
+ # Compression needs a proper algorithm
65
+ #
66
+ # o.on("-x", "--compress", "compress css file") do
67
+ # options[:compress] = true
68
+ # end
69
+
70
+ o.separator ""
71
+
72
+ # Help
73
+ o.on_tail("-h", "--help", "show this message") do
74
+ puts opts
75
+ exit
76
+ end
77
+
78
+ o.on_tail("-d", "--debug", "show full error messages") do
79
+ options[:debug] = true
80
+ end
81
+
82
+ # Version
83
+ o.on_tail("-v", "--version", "show version") do
84
+ puts "lessc " + Less.version
85
+ exit
86
+ end
87
+ end
88
+
89
+ opts.parse! # Parse arguments into `options` hash
90
+
91
+ # Get source and destintation from command line
92
+ case ARGV.size
93
+ when 1
94
+ options[:source] = ARGV[ 0 ]
95
+ when 2
96
+ options[:source] = ARGV[ 0 ]
97
+ options[:destination] = ARGV[ 1 ]
98
+ else
99
+ puts opts
100
+ exit
101
+ end
102
+
103
+ Less::Command.new( options ).run! ? exit(0) : exit(1)
@@ -0,0 +1,47 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{less-expander}
8
+ s.version = "0.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jeremy Boles"]
12
+ s.date = %q{2010-06-08}
13
+ s.default_executable = %q{lessc}
14
+ s.description = %q{Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties.}
15
+ s.email = %q{jeremy@jeremyboles.com}
16
+ s.executables = ["lessc"]
17
+ s.extra_rdoc_files = [
18
+ "README.markdown"
19
+ ]
20
+ s.files = [
21
+ "README.markdown",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "bin/lessc",
25
+ "less-expander.gemspec",
26
+ "lib/less/expander.rb"
27
+ ]
28
+ s.homepage = %q{http://github.com/jeremyboles/less-expander}
29
+ s.rdoc_options = ["--charset=UTF-8"]
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.3.7}
32
+ s.summary = %q{Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties.}
33
+
34
+ if s.respond_to? :specification_version then
35
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
+ s.specification_version = 3
37
+
38
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
39
+ s.add_runtime_dependency(%q<less>, [">= 1.2.21"])
40
+ else
41
+ s.add_dependency(%q<less>, [">= 1.2.21"])
42
+ end
43
+ else
44
+ s.add_dependency(%q<less>, [">= 1.2.21"])
45
+ end
46
+ end
47
+
@@ -0,0 +1,33 @@
1
+ require 'less'
2
+
3
+ module Less
4
+ module Expander
5
+ PREFIXES = %w(moz o webkit)
6
+ EXPANDERS = {
7
+ /\s*background\-image\s*:\s*gradient\((.+)\)\s*;/ => 'background-image: gradient(\1);' << PREFIXES.map {|p| "background-image: -#{p}-gradient(\\1);" }.join,
8
+ /\s*background\-size\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-background-size: \\1;" }.join,
9
+ /\s*border\-image\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-border-image: \\1;" }.join,
10
+ /\s*border\-radius\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-border-radius: \\1;" }.join,
11
+ /\s*box\-shadow\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-box-shadow: \\1;" }.join,
12
+ /\s*box\-sizing\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-box-sizing: \\1;" }.join,
13
+ /\s*column\-count\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-column-count: \\1;" }.join,
14
+ /\s*column\-gap\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-column-gap: \\1;" }.join,
15
+ /\s*column\-rule\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-column-rule: \\1;" }.join,
16
+ /\s*column\-width\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-column-width: \\1;" }.join,
17
+ /\s*user\-select\s*:\s*(.+);/i => '\0' + PREFIXES.map {|p| "-#{p}-user-select: \\1;" }.join
18
+ }
19
+
20
+ def self.included(base)
21
+ base.send(:alias_method, :prepare_without_expander, :prepare)
22
+ base.send(:alias_method, :prepare, :prepare_with_expander)
23
+ end
24
+
25
+ def prepare_with_expander
26
+ EXPANDERS.each { |reg, replace| @less.gsub!(reg, replace) } unless @expanded
27
+ @expanded = true
28
+ prepare_without_expander
29
+ end
30
+ end
31
+ end
32
+
33
+ Less::Engine.send(:include, Less::Expander)
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: less-expander
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
11
+ platform: ruby
12
+ authors:
13
+ - Jeremy Boles
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-08 00:00:00 -05:00
19
+ default_executable: lessc
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: less
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 53
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 21
34
+ version: 1.2.21
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties.
38
+ email: jeremy@jeremyboles.com
39
+ executables:
40
+ - lessc
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.markdown
45
+ files:
46
+ - README.markdown
47
+ - Rakefile
48
+ - VERSION
49
+ - bin/lessc
50
+ - less-expander.gemspec
51
+ - lib/less/expander.rb
52
+ has_rdoc: true
53
+ homepage: http://github.com/jeremyboles/less-expander
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options:
58
+ - --charset=UTF-8
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Monkey-patches the LessCSS library to expand CSS3 properties into browser-specific properties.
86
+ test_files: []
87
+