assets_packager 0.0.1.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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+/, " ") # 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
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
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module AssetsPackager
4
- VERSION = "0.0.1.1"
4
+ VERSION = "0.0.2"
5
5
  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: 73
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- - 1
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-03-11 00:00:00 +01:00
18
+ date: 2011-04-08 00:00:00 +02:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency