tipsy 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tipsy/compressors/css_compressor.rb +2 -1
- data/lib/tipsy/compressors/javascript_compressor.rb +2 -0
- data/lib/tipsy/handler/asset.rb +5 -2
- data/lib/tipsy/handler/static.rb +9 -0
- data/lib/tipsy/runner.rb +1 -1
- data/lib/tipsy/runners/compiler.rb +4 -3
- data/lib/tipsy/site.rb +3 -1
- data/lib/tipsy/version.rb +1 -1
- metadata +22 -22
@@ -4,7 +4,8 @@ module Tipsy
|
|
4
4
|
module Compressors
|
5
5
|
class CssCompressor
|
6
6
|
def compress(css)
|
7
|
-
|
7
|
+
css_style = Tipsy::Site.config.compile.compress_css ? :compressed : :nested
|
8
|
+
Sass::Engine.new(css, :syntax => :scss, :cache => false, :read_cache => false, :line_comments => false, :style => css_style).render
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -11,6 +11,7 @@ module Tipsy
|
|
11
11
|
|
12
12
|
module Closure
|
13
13
|
def compress(js)
|
14
|
+
return js unless Tipsy::Site.config.compile.compress_javascripts
|
14
15
|
return js if js.to_s.blank?
|
15
16
|
post_data = {
|
16
17
|
'compilation_level' => 'SIMPLE_OPTIMIZATIONS',
|
@@ -24,6 +25,7 @@ module Tipsy
|
|
24
25
|
|
25
26
|
module Uglifier
|
26
27
|
def compress(js)
|
28
|
+
return js unless Tipsy::Site.config.compile.compress_javascripts
|
27
29
|
::Uglifier.compile(js, :max_line_length => 500, :squeeze => true, :copyright => false)
|
28
30
|
end
|
29
31
|
end
|
data/lib/tipsy/handler/asset.rb
CHANGED
@@ -20,9 +20,12 @@ module Tipsy
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def map!
|
23
|
-
fpaths = [:javascripts_path, :css_path, :images_path].collect
|
23
|
+
fpaths = [:javascripts_path, :css_path, :images_path].collect do |p|
|
24
|
+
path = ::Pathname.new(Tipsy::Site.send(p))
|
25
|
+
(path.absolute? ? path.to_s : path.to_s.sub(/^\//,''))
|
26
|
+
end
|
24
27
|
fpaths.inject({}) do |hash, path|
|
25
|
-
hash.merge!("
|
28
|
+
hash.merge!("#{path}" => self.new)
|
26
29
|
end
|
27
30
|
end
|
28
31
|
end
|
data/lib/tipsy/handler/static.rb
CHANGED
@@ -17,6 +17,15 @@ module Tipsy
|
|
17
17
|
|
18
18
|
def call(env)
|
19
19
|
pathinfo = env['PATH_INFO']
|
20
|
+
|
21
|
+
if(File.basename(pathinfo) == "favicon.ico")
|
22
|
+
resp = static.call(env.merge!({ 'PATH_INFO' => pathinfo }))
|
23
|
+
unless 404 == resp[0]
|
24
|
+
resp[1].merge!({ "Pragma" => "nocache", "Cache-Control" => "max-age=0" })
|
25
|
+
return resp
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
found = nil
|
21
30
|
try_files.each do |path|
|
22
31
|
response = static.call(env.merge!({ 'PATH_INFO' => pathinfo + path }))
|
data/lib/tipsy/runner.rb
CHANGED
@@ -6,9 +6,10 @@ module Tipsy
|
|
6
6
|
class Compiler
|
7
7
|
include Tipsy::Utils::System
|
8
8
|
|
9
|
-
attr_reader :source_path, :dest_path, :scope
|
9
|
+
attr_reader :source_path, :dest_path, :scope, :site
|
10
10
|
|
11
|
-
def initialize
|
11
|
+
def initialize(args, site)
|
12
|
+
@site = site
|
12
13
|
@source_path = normalize_path(config.public_path)
|
13
14
|
@dest_path = normalize_path(config.compile_to)
|
14
15
|
excluded = [excludes, config.compile.preserve].flatten.uniq
|
@@ -113,7 +114,7 @@ module Tipsy
|
|
113
114
|
|
114
115
|
dirs.each do |path|
|
115
116
|
templates_in_path(path).each do |tpl|
|
116
|
-
next if ::File.directory?(File.join(path, tpl))
|
117
|
+
next if ::File.directory?(File.join(path, tpl)) || ::File.basename(tpl).to_s[0] == "_"
|
117
118
|
|
118
119
|
route = ::Pathname.new(path.gsub("#{Tipsy.root}/views", ""))
|
119
120
|
route = "/" if route.blank?
|
data/lib/tipsy/site.rb
CHANGED
@@ -41,7 +41,9 @@ module Tipsy
|
|
41
41
|
config.compile.assets = ['screen.css', 'site.js']
|
42
42
|
config.compile.preserve = [".svn", ".gitignore", ".git"]
|
43
43
|
config.compile.skip = []
|
44
|
-
|
44
|
+
|
45
|
+
config.compile.compress_css = true
|
46
|
+
config.compile.compress_javascripts = true
|
45
47
|
|
46
48
|
config.compile.enable_rewrite = true
|
47
49
|
config.compile.rewrite_mode = :htaccess
|
data/lib/tipsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tipsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70338554616740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70338554616740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack-test
|
27
|
-
requirement: &
|
27
|
+
requirement: &70338554616140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.6'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70338554616140
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: tilt
|
38
|
-
requirement: &
|
38
|
+
requirement: &70338554615580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '1.3'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70338554615580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &70338554615020 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0.6'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70338554615020
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass
|
60
|
-
requirement: &
|
60
|
+
requirement: &70338554614560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '3.1'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70338554614560
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
|
-
requirement: &
|
71
|
+
requirement: &70338554613980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '3.1'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70338554613980
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: sprockets
|
82
|
-
requirement: &
|
82
|
+
requirement: &70338554613420 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '2.0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70338554613420
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: hike
|
93
|
-
requirement: &
|
93
|
+
requirement: &70338554612860 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '1.2'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70338554612860
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: erubis
|
104
|
-
requirement: &
|
104
|
+
requirement: &70338554612340 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '2.7'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70338554612340
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: minitest
|
115
|
-
requirement: &
|
115
|
+
requirement: &70338554611840 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: '2.5'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70338554611840
|
124
124
|
description: Tipsy is a mini Rack application for working with static websites using
|
125
125
|
Tilt, and Sprockets.
|
126
126
|
email:
|