minify 0.1.0 → 0.1.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.
- data/Gemfile +5 -1
- data/README.md +38 -0
- data/lib/minify.rb +15 -2
- metadata +4 -1
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,44 @@ Minify your files based on their filetype.
|
|
6
6
|
|
7
7
|
__Documentation__
|
8
8
|
|
9
|
+
[Gem](http://rubydoc.info/gems/minify/0.1.0/frames)
|
10
|
+
[GitHub](http://rubydoc.info/github/c00lryguy/minify)
|
11
|
+
|
12
|
+
__Installation__
|
13
|
+
|
14
|
+
`gem install minify`
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
__Minify Strings__
|
19
|
+
|
20
|
+
Minify::Parser.call("text/html", "<html> <head></head> </html>")
|
21
|
+
# => "<html><head></head></html>"
|
22
|
+
|
23
|
+
This is the same as:
|
24
|
+
|
25
|
+
Minify::Parser.html("<html> <head></head> </html>")
|
26
|
+
|
27
|
+
__Minify Directories__
|
28
|
+
|
29
|
+
Minify.minimize('public/index.html', 'public/js/**/*')
|
30
|
+
|
31
|
+
This will copy the files to `./.minimize-cache` and minimize the original files.
|
32
|
+
If the file we're trying to minimize already exists in the cache and the mtime
|
33
|
+
is the same, we leave it alone.
|
34
|
+
|
35
|
+
Remember to add `.minimize-cache/**/*` to your `.gitignore` file.
|
36
|
+
|
37
|
+
Minify.maximize('public/index.html', 'public/js/**/*')
|
38
|
+
|
39
|
+
If the file we're trying to maximize is in `./.minimize-cache`, then we return
|
40
|
+
that files's contents. If not, we simply return it's contents.
|
41
|
+
|
42
|
+
__Minify Rack Responses__
|
43
|
+
|
44
|
+
Minify also acts as Rack middleware:
|
45
|
+
|
46
|
+
use Minify
|
9
47
|
|
10
48
|
## Contributing to gemology
|
11
49
|
|
data/lib/minify.rb
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'rack'
|
5
|
+
require 'mime/types'
|
6
|
+
require 'meta_tools'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
+
|
11
|
+
class Minify
|
12
|
+
VERSION = "0.1.1"
|
3
13
|
end
|
14
|
+
|
15
|
+
require 'core_ext/string'
|
16
|
+
require 'minify/parser'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -37,6 +37,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
37
|
- - ! '>='
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
hash: 4289741435717153150
|
40
43
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
44
|
none: false
|
42
45
|
requirements:
|