compass-tabs 0.1 → 0.2.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. checksums.yaml +4 -4
  2. data/README.md +31 -2
  3. data/lib/compass-tabs.rb +12 -3
  4. metadata +21 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2a869f53579149eae3ddf9af20fd0e5a119f4ae
4
- data.tar.gz: 4f419f8bf2eefc1f53b10b99667227c018a5f363
3
+ metadata.gz: b85c20a19a9b600aa7672b35f713eb7f0d3dff60
4
+ data.tar.gz: 525824d8f7b2a57887014dbd8cad56a1b16cbc0c
5
5
  SHA512:
6
- metadata.gz: 66a1ab2192efa6e50f165583fa0b323f195c6138f50b46d1173abaa522a992c3edf5f856408d51a81acad4142cd5fb234bf84c89976cfd2dd93b0ada382b8302
7
- data.tar.gz: 80cc349d90b2b155d680aa102c23fccd98f828c122e8847e91b054d9f7dc25fc09fb19ec7eeedb27f569e318d6f5fdb0a86e6c8a6fc46f58d8d8bea8942e1e1e
6
+ metadata.gz: 7d3d9262b8ccde60d353b47f30b7f560f9c1a5f7dade827a7b6b6402674a9c2652c5c3acc5a9558b47ecbf4cc81a5e00487cb6c587d23054983a12b18bee81ba
7
+ data.tar.gz: 606f9f5020e61981b29ebcb9b4a8259eed70d7aa4c8d080b926c8bd17325ea0e34a140508659e512bc352b3a3a1fb2033dc039f01a40ca8e591ff5e41fce2495
data/README.md CHANGED
@@ -1,4 +1,33 @@
1
- compass-tabs
1
+ # compass-tabs
2
2
  ============
3
3
 
4
- compass extension to convert spaces into tabstops in the output css files
4
+ This is a [compass](http://www.compass-style.org/ "compass") extension to convert spaces into tabstops in the output css files.
5
+
6
+ It will convert the 2-space indention of compass into tabstops:<br>**2 spaces will be converted into 1 tab.**
7
+
8
+ **Since v0.2 it converts also 2-space-indention in x-space-indention like in your config file.**
9
+
10
+ ## Installation
11
+ Just go to your terminal an type this
12
+
13
+ sudo gem install compass-tabs
14
+
15
+ ## How to use
16
+ In your compass config file add this line
17
+
18
+ require "compass-tabs"
19
+
20
+ From now on the extension is active and converts the default 2-space indention of compass into tabstops.
21
+
22
+ ### since v0.2
23
+ Since v0.2 you can add this lines to your compass config file.
24
+
25
+ # use tabs or spaces (true = default)
26
+ use_tabs = true
27
+ # adjust tabstop size
28
+ tab_size = 1
29
+ # adjust space size
30
+ space_size = 4
31
+
32
+ ## Note
33
+ This is is my first compass extension, so if you have some annotations don't hesitate and write it here.
@@ -1,14 +1,23 @@
1
1
  # REQUIREMENTS
2
2
  require 'compass'
3
+ require 'compass-configparser'
3
4
 
4
- # REGISTER THIS EXTENSION
5
- Compass::Frameworks.register('compass-tabs', :path => File.expand_path(File.join(File.dirname(__FILE__), "..")))
5
+
6
+ config = CompassConfigParser.new(Compass.detect_configuration_file)
7
+ tab_size = config.get_param('tab_size', 1).to_i
8
+ space_size = config.get_param('space_size', 2).to_i
9
+ use_tabs = config.get_param('use_tabs', 'true').match(/(true|t|yes|y|1)$/i) != nil
10
+
11
+ replace = use_tabs == true ? "\t" : "\s"
12
+ multi = use_tabs == true ? tab_size : space_size
6
13
 
7
14
  Compass.configuration.on_stylesheet_saved do |css_file|
8
15
  css = File.read(css_file)
16
+
9
17
  css.gsub!(/(^\s{2,})/) do
10
- "\t" * ($1.size/2).round
18
+ replace * ($1.size/2).round * multi
11
19
  end
20
+
12
21
  open(css_file, "w") do |f|
13
22
  f.write(css)
14
23
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-tabs
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tino Wehe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-01-09 00:00:00.000000000 Z
11
+ date: 2013-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.2
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.2
26
+ version: '0.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: compass-configparser
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
27
41
  description: compass plugin to convert spaces to tabs in your output css
28
42
  email: tino.wehe@brandrockers.com
29
43
  executables: []
@@ -53,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
67
  version: '0'
54
68
  requirements: []
55
69
  rubyforge_project:
56
- rubygems_version: 2.0.3
70
+ rubygems_version: 2.2.1
57
71
  signing_key:
58
72
  specification_version: 4
59
73
  summary: compass plugin to convert spaces to tabs