sqwish 0.2.0 → 0.2.0.1

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.
Files changed (4) hide show
  1. data/HISTORY.md +9 -6
  2. data/README.md +53 -0
  3. data/lib/sqwish.rb +11 -1
  4. metadata +1 -1
data/HISTORY.md CHANGED
@@ -1,18 +1,21 @@
1
+ v0.2.0.1 - Jul 17, 2012
2
+ -----------------------
3
+
4
+ * Update Sqwish to 0.2.0.
5
+ * Added Rails support.
6
+ * `strict: false` is now the default.
7
+
1
8
  v0.0.3 - Apr 26, 2011
2
9
  ---------------------
3
10
 
4
- ### Changed:
5
11
  * Update sqwish.
6
-
7
- ### Fixed:
8
- * V8/Therubyracer compatibility.
12
+ * Fixed V8/Therubyracer compatibility.
9
13
 
10
14
  v0.0.2 - Apr 26, 2011
11
15
  ---------------------
12
16
 
13
- Update sqwish.
17
+ * Update sqwish.
14
18
 
15
- First version.
16
19
  v0.0.1 - Apr 26, 2011
17
20
  ---------------------
18
21
 
data/README.md CHANGED
@@ -41,6 +41,59 @@ In your `config/environments/production.rb`:
41
41
 
42
42
  ``` ruby
43
43
  config.assets.css_compressor = Sqwish
44
+
45
+ # or use strict mode:
46
+ config.assets.css_compressor = Sqwish::Strict
47
+ ```
48
+
49
+ ### Why would I wanna use Sqwish for Rails?
50
+
51
+ If you use Sass (or a similar preprocessor), you probably separate your CSS
52
+ definitions into multiple files. In Sass, there are two ways to do this:
53
+
54
+ ``` scss
55
+ /* Method 1: @import */
56
+ @import 'common';
57
+ @import 'layout';
58
+ @import 'chrome';
59
+ @import 'pages';
60
+ ```
61
+
62
+ This is very convenient, and efficient in space, but slow. If you change one
63
+ Sass file, the rest will have to be recompiled. In big projects, you can be
64
+ waiting up to 10 seconds after updating a simple style.
65
+
66
+ Which leads us to method 2:
67
+
68
+ ```
69
+ /* Method 2: Sprockets require */
70
+ //= require common
71
+ //= require layout
72
+ //= require chrome
73
+ //= require pages
74
+ ```
75
+
76
+ This is faster! Updating one will no longer re-compile the others! The only
77
+ problem here is that styles may be duplicated in each file, say, if each
78
+ file depends on a web-font. You can end up with:
79
+
80
+ ``` css
81
+ /* Method 1's crappy output with YUI :( */
82
+ @font-face{font-family:'Montserrat';...}
83
+ body{font-family:Montserrat}
84
+ @font-face{font-family:'Montserrat';...}
85
+ .page h1{font-family:Montserrat}
86
+ ```
87
+
88
+ ...which YUI (Rails/Sprocket's default compressor) will not optimize for you.
89
+
90
+ Use Sqwish! It will remove those duplicate @font-faces for you and combine
91
+ anything else that can be combined.
92
+
93
+ ``` css
94
+ /* Method 2's nice output with YUI :D */
95
+ @font-face{font-family:'Montserrat';...}
96
+ body,.page h1{font-family:Montserrat}
44
97
  ```
45
98
 
46
99
  ## Authors
@@ -1,6 +1,7 @@
1
1
  require 'execjs'
2
2
 
3
3
  module Sqwish
4
+
4
5
  class << self
5
6
  def minify(src, options={:strict => false})
6
7
  is_strict = !! options[:strict]
@@ -31,7 +32,16 @@ module Sqwish
31
32
  end
32
33
 
33
34
  def version
34
- "0.2.0"
35
+ "0.2.0.1"
35
36
  end
36
37
  end
38
+
39
+ # For Rails
40
+ # config.assets.css_compressor = SqwishStrict
41
+ module Strict
42
+ def compress(src)
43
+ Sqwish.compress src, strict: true
44
+ end
45
+ end
46
+
37
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqwish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: