assets_packager 0.0.1.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,14 +14,23 @@ module AssetsPackager
|
|
14
14
|
|
15
15
|
# Thanks to Scott Becker
|
16
16
|
def self._compress_css(content) #:nodoc:
|
17
|
-
content.gsub!(/\s+/, " ")
|
18
|
-
content.gsub!(/\/\*(.*?)\*\/ /, "")
|
19
|
-
content.gsub!(/\} /, "}\n")
|
20
|
-
content.gsub!(/\n$/, "")
|
21
|
-
content.gsub!(/ \{ /, " {")
|
22
|
-
content.gsub!(/; \}/, "}")
|
17
|
+
content.gsub!(/\s+/, " ") # collapse space
|
18
|
+
content.gsub!(/\/\*(.*?)\*\/ /, "") # remove comments - caution, might want to remove this if using css hacks
|
19
|
+
content.gsub!(/\} /, "}\n") # add line breaks
|
20
|
+
content.gsub!(/\n$/, "") # remove last break
|
21
|
+
content.gsub!(/ \{ /, " {") # trim inside brackets
|
22
|
+
content.gsub!(/; \}/, "}") # trim inside brackets
|
23
|
+
content.gsub!(/url\((.*)\.(gif|jpg|png)\)/) { "url(#{_timestamp("#{$1}.#{$2}")})" } # append a timestamp like: /images/logo.png?1286374077
|
23
24
|
content
|
24
25
|
end
|
26
|
+
|
27
|
+
def self._timestamp(path) #:nodoc:
|
28
|
+
if ::File.exist?( expanded_path = ::File.expand_path(::File.join(AssetsPackager::Configuration.root_path, path)) )
|
29
|
+
path << "?#{::File.mtime(expanded_path).to_i}"
|
30
|
+
end
|
31
|
+
|
32
|
+
path
|
33
|
+
end
|
25
34
|
end
|
26
35
|
end
|
27
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assets_packager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
11
|
-
version: 0.0.1.1
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Luca Guidi
|
@@ -16,7 +15,7 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2011-
|
18
|
+
date: 2011-04-08 00:00:00 +02:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|