rack-less 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +20 -18
- data/lib/rack/less/base.rb +0 -1
- data/lib/rack/less/request.rb +0 -1
- data/lib/rack/less/source.rb +22 -2
- data/lib/rack/less/version.rb +2 -2
- data/lib/rack/less.rb +0 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -48,31 +48,31 @@ You should now see `Rack::Less` listed in the middleware pipeline:
|
|
48
48
|
rake middleware
|
49
49
|
|
50
50
|
== Available Options
|
51
|
-
key: name [default]: description
|
52
51
|
|
53
|
-
*
|
54
|
-
|
52
|
+
* :*root* ["."]
|
53
|
+
- The app root. The reference point for the source and public options.
|
55
54
|
|
56
|
-
*
|
57
|
-
|
55
|
+
* :*source* ['app/stylesheets']
|
56
|
+
- The path (relative to the root) where LESS source files are located
|
58
57
|
|
59
|
-
*
|
60
|
-
|
58
|
+
* :*public* ['public']
|
59
|
+
- The path where static files are located
|
61
60
|
|
62
|
-
*
|
63
|
-
|
61
|
+
* :*hosted_at* ['/stylesheets']
|
62
|
+
- The public HTTP path for hosted stylesheets.
|
64
63
|
|
65
64
|
== Available Configurations
|
66
|
-
key: name [default]: description
|
67
65
|
|
68
|
-
*
|
69
|
-
|
66
|
+
* .*cache* [false]
|
67
|
+
- Whether to cache the compilation output to a corresponding static file
|
70
68
|
|
71
|
-
*
|
72
|
-
|
69
|
+
* .*compress* [false]
|
70
|
+
- Whether or not to apply compression to the concatenation output
|
71
|
+
- :*yui* - use YUI Compressor (gem install yui-compressor)
|
72
|
+
- :*whitespace* - remove extraneous whitespace only.
|
73
73
|
|
74
|
-
*
|
75
|
-
|
74
|
+
* .*combinations* [{}]
|
75
|
+
- Directives for combining the output of many stylesheets and serving them as a single resource.
|
76
76
|
|
77
77
|
=== Combinations
|
78
78
|
|
@@ -112,9 +112,11 @@ then the same stylesheet link tags behave like they have the :cache option set,
|
|
112
112
|
|
113
113
|
== Links
|
114
114
|
|
115
|
-
GitHub
|
115
|
+
* *GitHub*
|
116
|
+
- http://github.com/kelredd/rack-less
|
116
117
|
|
117
|
-
Less
|
118
|
+
* *Less* *CSS*
|
119
|
+
- http://lesscss.org
|
118
120
|
|
119
121
|
== License
|
120
122
|
|
data/lib/rack/less/base.rb
CHANGED
data/lib/rack/less/request.rb
CHANGED
data/lib/rack/less/source.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
require 'less'
|
2
|
-
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "yui/compressor"
|
5
|
+
rescue LoadError
|
6
|
+
# only error about missing yui compressor if
|
7
|
+
# :yui compression is requested
|
8
|
+
end
|
3
9
|
|
4
10
|
module Rack::Less
|
5
11
|
|
@@ -13,6 +19,8 @@ module Rack::Less
|
|
13
19
|
# but also accept files with the .css extension
|
14
20
|
PREFERRED_EXTENSIONS = [:less, :css]
|
15
21
|
|
22
|
+
YUI_OPTS = {}
|
23
|
+
|
16
24
|
attr_reader :css_name
|
17
25
|
|
18
26
|
def initialize(css_name, options={})
|
@@ -43,7 +51,19 @@ module Rack::Less
|
|
43
51
|
Less::Engine.new(File.new(file_path)).to_css
|
44
52
|
end.join("\n")
|
45
53
|
|
46
|
-
compiled_css
|
54
|
+
compiled_css = case @compress
|
55
|
+
when :whitespace, true
|
56
|
+
compiled_css.delete("\n")
|
57
|
+
when :yui
|
58
|
+
if defined?(YUI::CssCompressor)
|
59
|
+
YUI::CssCompressor.new(YUI_OPTS).compress(compiled_css)
|
60
|
+
else
|
61
|
+
raise LoadError, "YUI::CssCompressor is not available. Install it with: gem install yui-compressor"
|
62
|
+
end
|
63
|
+
else
|
64
|
+
compiled_css
|
65
|
+
end
|
66
|
+
|
47
67
|
if cache? && !File.exists?(cf = File.join(@cache, "#{@css_name}.css"))
|
48
68
|
FileUtils.mkdir_p(@cache)
|
49
69
|
File.open(cf, "w") do |file|
|
data/lib/rack/less/version.rb
CHANGED
data/lib/rack/less.rb
CHANGED
@@ -48,7 +48,6 @@ module Rack::Less
|
|
48
48
|
|
49
49
|
# Create a new Rack::Less middleware component
|
50
50
|
# => the +options+ Hash can be used to specify default configuration values
|
51
|
-
# => a block can given as an alternate method for setting option values (see example above)
|
52
51
|
# => (see Rack::Less::Options for possible key/values)
|
53
52
|
def self.new(app, options={}, &block)
|
54
53
|
Base.new(app, options, &block)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-14 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|