collage 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/collage.rb +14 -3
  2. metadata +4 -6
  3. data/README.html +0 -23
  4. data/example/public/js.js +0 -10
@@ -122,9 +122,7 @@ class Collage
122
122
 
123
123
  class Sass < self
124
124
  def package_file(file)
125
- contents = File.read(file)
126
-
127
- contents = ::Sass::Engine.new(contents).render if File.extname(file) == ".sass"
125
+ contents = render(file)
128
126
 
129
127
  inject_timestamps(contents)
130
128
  end
@@ -142,6 +140,19 @@ class Collage
142
140
  "#{$1}#{$2}#{stamp}#{$3}"
143
141
  end
144
142
  end
143
+
144
+ def render(file)
145
+ contents = File.read(file)
146
+
147
+ extension = File.extname(file)[1..-1]
148
+
149
+ case extension
150
+ when "sass", "scss"
151
+ contents = ::Sass::Engine.new(contents, syntax: extension.to_sym).render
152
+ end
153
+
154
+ contents
155
+ end
145
156
  end
146
157
  end
147
158
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Damian Janowski
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2009-03-01 00:00:00 -02:00
17
+ date: 2009-03-01 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -28,15 +28,13 @@ extra_rdoc_files:
28
28
  - README.markdown
29
29
  files:
30
30
  - lib/collage.rb
31
- - README.html
32
31
  - README.markdown
33
32
  - Rakefile
34
33
  - vendor/yuicompressor-2.4.2.jar
35
34
  - example/config.ru
36
35
  - example/public/app.js
37
36
  - example/public/jquery.js
38
- - example/public/js.js
39
- has_rdoc: true
37
+ has_rdoc: false
40
38
  homepage:
41
39
  licenses: []
42
40
 
@@ -1,23 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC
3
- "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
4
- "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
5
- <html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
6
- <head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>Collage</title></head>
7
- <body>
8
- <h1 id='collage'>Collage</h1>
9
-
10
- <p>This is a Rack middleware that will package all your Javascript into a single file (very much inspired by Rails&#8217; <code>javascript_include_tag(:all, :cache =&gt; true)</code>.</p>
11
-
12
- <p>Examples:</p>
13
-
14
- <pre><code>use Collage, :path =&gt; File.dirname(__FILE__) + &quot;/public&quot;
15
-
16
- use Collage,
17
- :path =&gt; File.dirname(__FILE__) + &quot;/public&quot;,
18
- :files =&gt; [&quot;jquery*.js&quot;, &quot;*.js&quot;]</code></pre>
19
-
20
- <p>Collage also provides a handy helper for your views:</p>
21
-
22
- <pre><code>&lt;%= Collage.html_tag(&quot;/public&quot;) %&gt;</code></pre>
23
- </body></html>
@@ -1,10 +0,0 @@
1
- $(document).ready(function() {
2
- // Something useful
3
- });
4
-
5
-
6
- //
7
- // jQuery here
8
- //
9
-
10
-