cssDir2 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +71 -0
  2. data/lib/cssDir2.rb +25 -0
  3. metadata +99 -0
@@ -0,0 +1,71 @@
1
+ # Welcome to cssDir2
2
+
3
+ cssDir2 is a simple ruby script for compass to copy the generated css file to a different location.
4
+
5
+ # How to install?
6
+
7
+ 1. Install [Compass](http://compass-style.org/)<br />
8
+ `$ gem update --system`<br />
9
+ `$ gem install compass`
10
+ 2. Install cssDir2<br />
11
+ `$ gem install cssDir2`
12
+ 3. Require it in your config.rb<br />
13
+ `require 'cssDir2'`<br />
14
+ 4. That's it!
15
+
16
+ # How to use it?
17
+
18
+ Open up your __config.rb__ and create a variable where you specify the path to the location where you want cssDir2 to copy the generated css file to __based on the location of your sass file__.
19
+
20
+ ```ruby
21
+ css_dir2 = "../path/to/directory"
22
+ ```
23
+
24
+ When the specified directory doesn't exist, cssDir2 will create it.<br />
25
+ Now call cssDir2 and start watching your project with Compass!
26
+
27
+ ```ruby
28
+ CssDir2.new(css_dir, css_dir2)
29
+ ```
30
+
31
+ You could also skip the creation of a variable and pass in the path directly into the 2nd argument.
32
+
33
+ ```ruby
34
+ CssDir2.new(css_dir, "../path/to/directory")
35
+ ```
36
+
37
+ __An example config.rb file would look like the following:__
38
+
39
+ ```ruby
40
+ # Require any additional compass plugins here.
41
+
42
+ # Set this to the root of your project when deployed:
43
+ http_path = "/"
44
+ css_dir = "stylesheets"
45
+ sass_dir = "sass"
46
+ images_dir = "images"
47
+ javascripts_dir = "javascripts"
48
+
49
+ # You can select your preferred output style here (can be overridden via the command line):
50
+ # output_style = :expanded or :nested or :compact or :compressed
51
+
52
+ # To enable relative paths to assets via compass helper functions. Uncomment:
53
+ # relative_assets = true
54
+
55
+ # To disable debugging comments that display the original location of your selectors. Uncomment:
56
+ # line_comments = false
57
+
58
+
59
+ # If you prefer the indented syntax, you might want to regenerate this
60
+ # project again passing --syntax sass, or you can uncomment this:
61
+ # preferred_syntax = :sass
62
+ # and then run:
63
+ # sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
64
+
65
+ # cssDir2
66
+ require 'cssDir2'
67
+
68
+ css_dir2 = "../css"
69
+
70
+ CssDir2.new(css_dir, css_dir2)
71
+ ```
@@ -0,0 +1,25 @@
1
+ require 'fileutils'
2
+ require 'colorize'
3
+ require 'compass'
4
+
5
+ class CssDir2
6
+ def initialize(css_dir, css_dir2)
7
+ puts "cssDir2 is now running...".green
8
+
9
+ Compass.configuration.on_stylesheet_saved do |file|
10
+ if File.exists?(file)
11
+ directory = File.dirname(file) + "/" + css_dir2 + "/"
12
+
13
+ if !File.exists?(directory) && !File.directory?(directory)
14
+ Dir.mkdir(directory)
15
+ puts "directory ".green + css_dir2 + "/"
16
+ end
17
+
18
+ basefile = File.basename(file)
19
+
20
+ FileUtils.cp(file, directory + basefile)
21
+ puts "copy ".blue + css_dir + "/" + basefile + " to " + css_dir2 + "/"+ basefile
22
+ end
23
+ end
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cssDir2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 3
10
+ version: 1.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Michael 'Miw0' Worm
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-05-16 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: compass
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 43
30
+ segments:
31
+ - 0
32
+ - 12
33
+ - 2
34
+ version: 0.12.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: colorize
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 5
49
+ - 8
50
+ version: 0.5.8
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description: A Compass Extension to copy the generated css file to a different location.
54
+ email: work@michael-worm.de
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - README.md
63
+ - lib/cssDir2.rb
64
+ has_rdoc: true
65
+ homepage: https://github.com/Miw0/cssDir2
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirements: []
92
+
93
+ rubyforge_project:
94
+ rubygems_version: 1.3.7
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: A Compass Extension to copy the generated css file to a different location.
98
+ test_files: []
99
+