jekyll-compass 0.2.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d93609ebf6e64e59366da721574af95ec2006cad
4
- data.tar.gz: 666426f2543bab3764d4145cc51661f16fc4a326
3
+ metadata.gz: ffa827930be0e2098c716ef4fa62a74c2b5ef41b
4
+ data.tar.gz: 9839292d3ef5da2f8dfecdb1dc3f63f56ee6fbd3
5
5
  SHA512:
6
- metadata.gz: 034f87ad90df979c6c1f1174268c634ae4d070c0ea556f02d5e98971e9a0f798514e2f83592a2fb105dd48137f49a37c8228b578c9894a65adce3f87060b153e
7
- data.tar.gz: fac5293a83e1b23269d420b9c34167842f03586b7dc38e4bdd4e37505a0ef3f550a03d9e6676940b17872888ede1abcee27dd4e6ccecafda7df344849345371d
6
+ metadata.gz: af45a1cd54f3c1e9d77fc68e19384a71c5503b7100ccfde0683c14ef7579df9e5d2ddb5cc450b2bf4b79c9f8327dba5ba64622aa5ccaf6b052a32ca58250a70c
7
+ data.tar.gz: ef1ddc47d7396cb221172e67c6dc620641691b57fc782664c718e6053bc6e5e6d458b471debd9b57796456afc0b4a43ca515c171f808c02d19b4060b7c1b813d
@@ -1,4 +1,5 @@
1
1
 
2
- # This is simply a router file. We don't do anything here except require what need to for the plugin to work.
3
- # This is the file that jekyll requires by default.
2
+ # This is simply a router file. We don't do anything here except require the *actual* file for our gem
3
+ # This is the file that jekyll requires by default. Ideally it shouldn't exist.
4
+ # @see http://guides.rubygems.org/name-your-gem/
4
5
  require 'jekyll/compass'
@@ -1,86 +1,4 @@
1
1
 
2
- require 'sass/plugin'
3
- require 'compass'
4
- require 'compass/commands'
5
- require 'fileutils'
6
-
2
+ require 'jekyll/compass/compass_file'
7
3
  require 'jekyll/compass/core_ext'
8
-
9
- module Jekyll
10
- class CompassFile < StaticFile
11
- def write(destination)
12
- # Short-circuit to the inevitable
13
- false
14
- end
15
- end
16
-
17
- class Compass < Generator
18
- safe true
19
- priority :high
20
-
21
- def generate(site)
22
- @site = site
23
- input_directory = File.join(@site.source, '_sass')
24
-
25
- return unless File.exist? input_directory
26
- puts
27
-
28
- config = configuration(@site.source, input_directory, File.join(@site.config['destination'], 'css'))
29
- configure_compass(config)
30
-
31
- ::Compass::Commands::UpdateProject.new(site.config['source'], config).execute
32
- nil
33
- end
34
-
35
- private
36
-
37
- def configuration(source, input_directory, output_directory)
38
- config = {
39
- :project_path => source,
40
- :http_path => '/',
41
- :sass_path => input_directory,
42
- :css_path => output_directory,
43
- :images_path => File.join(source, 'images'),
44
- :javascripts_path => File.join(source, 'js'),
45
- :environment => :production,
46
- :output_style => :compact,
47
- }
48
-
49
- user_config = @site.config['compass']
50
- config.deep_merge!(user_config.symbolize_keys) if user_config
51
- user_data = @site.data['compass']
52
- config.deep_merge!(user_data.symbolize_keys) if user_data
53
-
54
- config
55
- end
56
-
57
- def configure_compass(config)
58
- ::Compass.add_configuration(config, 'Jekyll::Compass')
59
-
60
- ::Compass.configuration.on_stylesheet_saved &method(:on_stylesheet_saved)
61
- ::Compass.configuration.on_sprite_saved &method(:on_sprite_saved)
62
- ::Compass.configuration.on_sprite_removed &method(:on_sprite_removed)
63
- end
64
-
65
- def on_stylesheet_saved(filename)
66
- source = @site.config['destination']
67
- @site.static_files << CompassFile.new(@site, source, File.dirname(filename)[source.length..-1], File.basename(filename))
68
- end
69
-
70
- def on_sprite_saved(filename)
71
- @site.static_files << StaticFile.new(@site, @site.source, File.dirname(filename)[@site.source.length..-1], File.basename(filename))
72
- end
73
-
74
- def on_sprite_removed(filename)
75
- @site.static_files = @site.static_files.select do |p|
76
- if p.path == filename
77
- sprite_output = p.destination(@site.config['destination'])
78
- File.delete sprite_output if File.exist? sprite_output
79
- false
80
- else
81
- true
82
- end
83
- end
84
- end
85
- end
86
- end
4
+ require 'jekyll/compass/generator'
@@ -0,0 +1,11 @@
1
+
2
+ module Jekyll
3
+ module Compass
4
+ class CompassFile < StaticFile
5
+ def write(destination)
6
+ # Short-circuit to the inevitable
7
+ false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,80 @@
1
+
2
+ require 'sass/plugin'
3
+ require 'compass'
4
+ require 'compass/commands'
5
+ require 'fileutils'
6
+
7
+ module Jekyll
8
+ module Compass
9
+ class Generator < ::Jekyll::Generator
10
+ safe true
11
+ priority :high
12
+
13
+ def generate(site)
14
+ @site = site
15
+ input_directory = File.join(@site.source, '_sass')
16
+
17
+ return unless File.exist? input_directory
18
+ puts
19
+
20
+ config = configuration(@site.source, input_directory, File.join(@site.config['destination'], 'css'))
21
+ configure_compass(config)
22
+
23
+ ::Compass::Commands::UpdateProject.new(site.config['source'], config).execute
24
+ nil
25
+ end
26
+
27
+ private
28
+
29
+ def configuration(source, input_directory, output_directory)
30
+ config = {
31
+ :project_path => source,
32
+ :http_path => '/',
33
+ :sass_path => input_directory,
34
+ :css_path => output_directory,
35
+ :images_path => File.join(source, 'images'),
36
+ :javascripts_path => File.join(source, 'js'),
37
+ :environment => :production,
38
+ :output_style => :compact,
39
+ :force => true,
40
+ }
41
+
42
+ user_config = @site.config['compass']
43
+ config.deep_merge!(user_config.symbolize_keys) if user_config
44
+ user_data = @site.data['compass']
45
+ config.deep_merge!(user_data.symbolize_keys) if user_data
46
+
47
+ config
48
+ end
49
+
50
+ def configure_compass(config)
51
+ ::Compass.add_configuration(config, 'Jekyll::Compass')
52
+
53
+ ::Compass.configuration.on_stylesheet_saved &method(:on_stylesheet_saved)
54
+ ::Compass.configuration.on_sprite_saved &method(:on_sprite_saved)
55
+ ::Compass.configuration.on_sprite_removed &method(:on_sprite_removed)
56
+ end
57
+
58
+ def on_stylesheet_saved(filename)
59
+ source = @site.config['destination']
60
+ @site.static_files << CompassFile.new(@site, source, File.dirname(filename)[source.length..-1], File.basename(filename))
61
+ end
62
+
63
+ def on_sprite_saved(filename)
64
+ @site.static_files << StaticFile.new(@site, @site.source, File.dirname(filename)[@site.source.length..-1], File.basename(filename))
65
+ end
66
+
67
+ def on_sprite_removed(filename)
68
+ @site.static_files = @site.static_files.select do |p|
69
+ if p.path == filename
70
+ sprite_output = p.destination(@site.config['destination'])
71
+ File.delete sprite_output if File.exist? sprite_output
72
+ false
73
+ else
74
+ true
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-compass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Scharley
@@ -46,7 +46,9 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - lib/jekyll/compass/compass_file.rb
49
50
  - lib/jekyll/compass/core_ext.rb
51
+ - lib/jekyll/compass/generator.rb
50
52
  - lib/jekyll/compass.rb
51
53
  - lib/jekyll-compass.rb
52
54
  - README.md