jekyll-compass 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll/compass/generator.rb +45 -16
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc734c3951787df164f485ec108768f42e63455e
4
- data.tar.gz: a1d70d24c2c9cd71cf8a490a7c94010a8ea75ca7
3
+ metadata.gz: 2b48486097b59cef67758554dd741e1520d1872a
4
+ data.tar.gz: a9dcd89043b048a3bf01ee0180ba7ede6cc50c2c
5
5
  SHA512:
6
- metadata.gz: 17f2e9358d732a149e6d4bd3031007fc01edd67470244816b78a0f7fde16f181e1920b7761cd19e4fb1a3476ede481c7acffa312051d3c1896a0f6192726ed35
7
- data.tar.gz: 9863583fe8ffb6d13e628563e6151da9614a4029edaf2bccd249ba077506e75fb856727430288d9c497939d834e1593cf6bab8b9b76a987a950b6ef5b453b030
6
+ metadata.gz: ab489d313433d8c11c68db1094f214b73b4ef55025749d3e673f35760a116114fde70f6059770c71662721c679b196734994714e6cf3e65b7b21377603068f79
7
+ data.tar.gz: 62bb9c6363569e5f76fe3400fef75af7298132cce56d09ae2857debf8db738034fac8dadda0cface9931ea2fc642a0f18293b54ebfbb1c2a47fb1e38ab80be44
@@ -22,20 +22,21 @@ module Jekyll
22
22
  # @return [void]
23
23
  def generate(site)
24
24
  @site = site
25
- input_directory = File.join(@site.source, '_sass')
26
25
 
27
- return unless File.exist? input_directory
28
- puts
29
-
30
- config = configuration(
31
- @site.source,
32
- input_directory,
33
- File.join(@site.config['destination'], 'css')
34
- )
26
+ config = configuration(@site.source)
27
+ puts "\rGenerating Compass: #{config[:sass_path]}" +
28
+ " => #{config[:css_path]}"
29
+ unless File.exist? config[:sass_path]
30
+ print " Generating... "
31
+ return
32
+ end
35
33
  configure_compass(config)
36
34
 
37
35
  ::Compass::Commands::UpdateProject.new(site.config['source'], config).
38
36
  execute
37
+
38
+ puts
39
+ print " Generating... "
39
40
  nil
40
41
  end
41
42
 
@@ -45,19 +46,16 @@ module Jekyll
45
46
  # from `_config.yml` as well as `_data/compass.yml`.
46
47
  #
47
48
  # @param source [String] The project source folder
48
- # @param input_directory [String] The folder containing the Sass files
49
- # @param output_directory [String] The folder to output CSS files to
50
49
  # @return [Hash]
51
- def configuration(source, input_directory, output_directory)
50
+ def configuration(source)
52
51
  config = {
53
52
  :project_path => source,
54
53
  :http_path => '/',
55
- :sass_path => input_directory,
56
- :css_path => output_directory,
54
+ :sass_dir => '_sass',
55
+ :css_dir => 'css',
57
56
  :images_path => File.join(source, 'images'),
58
57
  :javascripts_path => File.join(source, 'js'),
59
58
  :environment => :production,
60
- :output_style => :compact,
61
59
  :force => true,
62
60
  }
63
61
 
@@ -66,6 +64,33 @@ module Jekyll
66
64
  user_data = @site.data['compass']
67
65
  config = deep_merge!(config, symbolize_keys(user_data)) if user_data
68
66
 
67
+ unless config.key? :sass_path
68
+ config[:sass_path] =
69
+ File.join(source, config[:sass_dir])
70
+ end
71
+ unless config.key? :css_path
72
+ config[:css_path] =
73
+ File.join(@site.config['destination'], config[:css_dir])
74
+ end
75
+
76
+ symbolize_configuration!(config)
77
+ end
78
+
79
+ # Symbolize values for configuration values which require it.
80
+ #
81
+ # @param config [Hash]
82
+ # @return [Hash]
83
+ def symbolize_configuration!(config)
84
+ [
85
+ :project_type,
86
+ :environment,
87
+ :output_style,
88
+ :preferred_syntax,
89
+ :sprite_engine,
90
+ ].each do |k|
91
+ config[k] = config[k].to_sym if config.key? k
92
+ end
93
+
69
94
  config
70
95
  end
71
96
 
@@ -162,7 +187,11 @@ module Jekyll
162
187
  target = hash.dup
163
188
 
164
189
  target.keys.each do |key|
165
- target[(key.to_sym rescue key) || key] = target.delete(key)
190
+ value = target.delete(key)
191
+ if value.is_a? Hash
192
+ value = symbolize_keys(value)
193
+ end
194
+ target[(key.to_sym rescue key) || key] = value
166
195
  end
167
196
 
168
197
  target
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-compass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Scharley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-21 00:00:00.000000000 Z
11
+ date: 2014-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: jekyll
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  description: |2