mini_css 0.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 (5) hide show
  1. data/README.markdown +35 -0
  2. data/Rakefile +48 -0
  3. data/bin/mini_css +24 -0
  4. data/lib/mini_css.rb +20 -0
  5. metadata +84 -0
data/README.markdown ADDED
@@ -0,0 +1,35 @@
1
+ Minimise your CSS files using by compressing and combining them into one file.
2
+ Reduce HTTP requests, file size, and save bandwidth.
3
+ ## Installation
4
+
5
+ gem install mini_css
6
+
7
+ ## Usage
8
+
9
+ Using `mini_css` is simple! You can go about it two ways:
10
+
11
+ 1. You can run it from the command line and use it as part of your deployment
12
+ proceedure.
13
+ 2. You can use it as a class and use the compressed results as necessary.
14
+
15
+ ### Using `mini_css` from the command line
16
+
17
+ Using `mini_css` from the command line is too simple:
18
+
19
+ mini_css [-o output_file] file_name[, file_name2, ...]
20
+
21
+ You can compress one CSS file, or compress more than one to mash them together
22
+ as one big compress file.
23
+
24
+ You can specify the location and name of the output file; it defaults to
25
+ mini_cssified.css in the current working directory.
26
+
27
+ ### Using `mini_css` as a class
28
+
29
+ To use `mini_css` as a class, simply require the right files and you're away.
30
+
31
+ require 'rubygems'
32
+ require 'mini_css'
33
+
34
+ files = [] # Fill this aray with file paths.
35
+ Mini_CSS.compress(files) # mini_css will open them all, compress them, and mash them together
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ #
2
+ # To change this template, choose Tools | Templates
3
+ # and open the template in the editor.
4
+
5
+ require 'rubygems'
6
+ require 'rake'
7
+ require 'rake/clean'
8
+ require 'rake/gempackagetask'
9
+ require 'rake/rdoctask'
10
+ require 'rake/testtask'
11
+ require 'lib/mini_css'
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = 'mini_css'
15
+ s.version = '0.0.1'
16
+ s.has_rdoc = true
17
+ s.extra_rdoc_files = ['README.markdown']
18
+ s.summary = 'Minimise your CSS files using by compressing and combining them into one file. Reduce HTTP requests, file size, and save bandwidth.'
19
+ s.description = s.summary + ' See http://github.com/nathankleyn/mini_css for more information.'
20
+ s.author = 'Nathan Kleyn'
21
+ s.email = 'nathan@unfinitydesign.com'
22
+ s.executables = ['mini_css']
23
+ s.files = %w(README.markdown Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
24
+ s.require_path = "lib"
25
+ s.bindir = "bin"
26
+
27
+ # Adding the dependencies we need.
28
+ s.add_dependency('rainpress', '>= 1.0')
29
+ end
30
+
31
+ Rake::GemPackageTask.new(spec) do |p|
32
+ p.gem_spec = spec
33
+ p.need_tar = true
34
+ p.need_zip = true
35
+ end
36
+
37
+ Rake::RDocTask.new do |rdoc|
38
+ files =['README.markdown', 'lib/**/*.rb']
39
+ rdoc.rdoc_files.add(files)
40
+ rdoc.main = "README.markdown" # page to start on
41
+ rdoc.title = "mini_css Docs"
42
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
43
+ rdoc.options << '--line-numbers'
44
+ end
45
+
46
+ Rake::TestTask.new do |t|
47
+ t.test_files = FileList['test/**/*.rb']
48
+ end
data/bin/mini_css ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), *%w[.. lib mini_css])
4
+
5
+ STDOUT.sync = true
6
+
7
+ output_location = ARGV[ARGV.index('-o') + 1] if ARGV.include?('-o')
8
+ output_location ||= File.join(Dir.getwd, 'mini_cssified.css')
9
+
10
+ puts 'Saving all compressed CSS in one file at "' + output_location + '"...'
11
+
12
+ files = ARGV
13
+ if files.include?('-o')
14
+ files.delete_at(files.index('-o') + 1)
15
+ files.delete_at(files.index('-o'))
16
+ end
17
+
18
+ output = Mini_CSS.compress(files)
19
+
20
+ File.open(output_location, 'w+') do |f|
21
+ f.write(output)
22
+ end
23
+
24
+ puts 'Done!'
data/lib/mini_css.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require 'rainpress'
3
+
4
+ class Mini_CSS
5
+ def self.version
6
+ '0.0.1'
7
+ end
8
+
9
+ def self.compress(files)
10
+ output = []
11
+ files.each do |file|
12
+ File.open(file) do |f|
13
+ output << '/* Compressed CSS From ' + File.basename(file) + ' */'
14
+ output << Rainpress.compress(f.readlines.join("\n"))
15
+ end
16
+ end
17
+
18
+ output.join("\n\n")
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mini_css
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Nathan Kleyn
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-05-26 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rainpress
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 1
32
+ - 0
33
+ version: "1.0"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: Minimise your CSS files using by compressing and combining them into one file. Reduce HTTP requests, file size, and save bandwidth. See http://github.com/nathankleyn/mini_css for more information.
37
+ email: nathan@unfinitydesign.com
38
+ executables:
39
+ - mini_css
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - README.markdown
44
+ files:
45
+ - README.markdown
46
+ - Rakefile
47
+ - bin/mini_css
48
+ - lib/mini_css.rb
49
+ has_rdoc: true
50
+ homepage:
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.3.7
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: Minimise your CSS files using by compressing and combining them into one file. Reduce HTTP requests, file size, and save bandwidth.
83
+ test_files: []
84
+