middleman-more 3.1.0.beta.1 → 3.1.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1df77f4d11379ce20fec027e19c1bdbe25ebe5f
4
+ data.tar.gz: 23137fa1344a5ce4a2fd3b2b2b487d9fef92664d
5
+ SHA512:
6
+ metadata.gz: 549c6712e66858016fddceedf9aadce140159a6258098535a69f15beddcc7cf79d579413549ed329a1ac270a3d089cef0d10002b2927b435a2706b4e429076cf
7
+ data.tar.gz: 156fbf13a8828514215da7688a96d72edd4bc7b7ad53c747563aa3ded4fa64460bccfe917c3b50158a4b9aa8ac5981b9e0a9f9b0bc19222d41f9910a3baca014
@@ -57,13 +57,13 @@ Feature: Assets get a file hash appended to their and references to them are upd
57
57
  Scenario: Enabling an asset host still produces hashed files and references
58
58
  Given the Server is running at "asset-hash-host-app"
59
59
  When I go to "/"
60
- Then I should see 'href="http://middlemanapp.com/stylesheets/site-171eb3c0.css"'
60
+ Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"'
61
61
  And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
62
62
  When I go to "/subdir/"
63
- Then I should see 'href="http://middlemanapp.com/stylesheets/site-171eb3c0.css"'
63
+ Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"'
64
64
  And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
65
65
  When I go to "/other/"
66
- Then I should see 'href="http://middlemanapp.com/stylesheets/site-171eb3c0.css"'
66
+ Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"'
67
67
  And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
68
68
  # Asset helpers don't appear to work from Compass right now
69
69
  # When I go to "/stylesheets/site-e5a31a3e.css"
@@ -1,7 +1,56 @@
1
1
  Feature: Alternate between multiple asset hosts
2
2
  In order to speed up page loading
3
-
4
- Scenario: Rendering html with the feature enabled
5
- Given the Server is running at "asset-host-app"
3
+
4
+ Scenario: Set single host globally
5
+ Given a fixture app "asset-host-app"
6
+ And a file named "config.rb" with:
7
+ """
8
+ activate :asset_host
9
+ set :asset_host, "http://assets1.example.com"
10
+ """
11
+ And the Server is running
6
12
  When I go to "/asset_host.html"
13
+ Then I should see "http://assets1"
14
+ When I go to "/stylesheets/asset_host.css"
15
+ Then I should see "http://assets1"
16
+
17
+ Scenario: Set proc host globally
18
+ Given a fixture app "asset-host-app"
19
+ And a file named "config.rb" with:
20
+ """
21
+ activate :asset_host
22
+ set :asset_host do |asset|
23
+ "http://assets%d.example.com" % (asset.hash % 4)
24
+ end
25
+ """
26
+ And the Server is running
27
+ When I go to "/asset_host.html"
28
+ Then I should see "http://assets"
29
+ When I go to "/stylesheets/asset_host.css"
30
+ Then I should see "http://assets"
31
+
32
+ Scenario: Set single host with inline-option
33
+ Given a fixture app "asset-host-app"
34
+ And a file named "config.rb" with:
35
+ """
36
+ activate :asset_host, :host => "http://assets1.example.com"
37
+ """
38
+ And the Server is running
39
+ When I go to "/asset_host.html"
40
+ Then I should see "http://assets1"
41
+ When I go to "/stylesheets/asset_host.css"
42
+ Then I should see "http://assets1"
43
+
44
+ Scenario: Set proc host with inline-option
45
+ Given a fixture app "asset-host-app"
46
+ And a file named "config.rb" with:
47
+ """
48
+ activate :asset_host, :host => Proc.new { |asset|
49
+ "http://assets%d.example.com" % (asset.hash % 4)
50
+ }
51
+ """
52
+ And the Server is running
53
+ When I go to "/asset_host.html"
54
+ Then I should see "http://assets"
55
+ When I go to "/stylesheets/asset_host.css"
7
56
  Then I should see "http://assets"
@@ -133,14 +133,14 @@ Feature: Minify Javascript
133
133
  Then I should see:
134
134
  """
135
135
  <script>
136
- (function(){this,should(),all.be(),on={one:line}})();
136
+ (function(){should(),all.be(),on={one:line}})();
137
137
  </script>
138
138
  <script>
139
- (function(){this,should(),too()})();
139
+ (function(){should(),too()})();
140
140
  </script>
141
141
  <script type='text/javascript'>
142
142
  //<!--
143
- (function(){one,line(),here()})();
143
+ (function(){line(),here()})();
144
144
  //-->
145
145
  </script>
146
146
  <script type='text/html'>
@@ -1,6 +0,0 @@
1
- set :layout, false
2
-
3
- activate :asset_host
4
- set :asset_host do |asset|
5
- "http://assets%d.example.com" % (asset.hash % 4)
6
- end
@@ -1,92 +1,75 @@
1
- module Middleman
2
- module CoreExtensions
3
-
4
- # Forward the settings on config.rb and the result of registered
5
- # extensions to Compass
6
- module Compass
7
-
8
- # Extension registered
9
- class << self
10
-
11
- # Once registered
12
- def registered(app)
13
- # Require the library
14
- require "compass"
15
-
16
- # Hooks to manually update the compass config after we're
17
- # done with it
18
- app.define_hook :compass_config
19
-
20
- # Location of SASS/SCSS files external to source directory.
21
- # @return [Array]
22
- # config[:sass_assets_paths] = ["#{root}/assets/sass/", "/path/2/external/sass/repository/"]
23
- app.config.define_setting :sass_assets_paths, [], 'Paths to extra SASS/SCSS files'
24
-
25
- app.after_configuration do
26
- ::Compass.configuration do |compass_config|
27
- compass_config.project_path = source_dir
28
- compass_config.environment = :development
29
- compass_config.cache_path = config[:sass_cache_path]
30
- compass_config.sass_dir = config[:css_dir]
31
- compass_config.css_dir = config[:css_dir]
32
- compass_config.javascripts_dir = config[:js_dir]
33
- compass_config.fonts_dir = config[:fonts_dir]
34
- compass_config.images_dir = config[:images_dir]
35
- compass_config.http_path = config[:http_prefix]
36
-
37
- config[:sass_assets_paths].each do |path|
38
- compass_config.add_import_path path
39
- end
40
-
41
- # Disable this initially, the cache_buster extension will
42
- # re-enable it if requested.
43
- compass_config.asset_cache_buster :none
44
-
45
- # Disable this initially, the relative_assets extension will
46
-
47
- compass_config.relative_assets = false
48
-
49
- # Default output style
50
- compass_config.output_style = :nested
51
-
52
- # No line-comments in test mode (changing paths mess with sha1)
53
- compass_config.line_comments = false if ENV["TEST"]
54
-
55
- if config.defines_setting?(:asset_host) && config[:asset_host].is_a?(Proc)
56
- compass_config.asset_host(&config[:asset_host])
57
- end
58
- end
59
-
60
- # Call hook
61
- run_hook :compass_config, ::Compass.configuration
62
-
63
- # Tell Tilt to use it as well (for inline sass blocks)
64
- ::Tilt.register 'sass', CompassSassTemplate
65
- ::Tilt.prefer(CompassSassTemplate)
66
-
67
- # Tell Tilt to use it as well (for inline scss blocks)
68
- ::Tilt.register 'scss', CompassScssTemplate
69
- ::Tilt.prefer(CompassScssTemplate)
70
- end
71
- end
72
- alias :included :registered
73
- end
1
+ class Middleman::CoreExtensions::Compass < ::Middleman::Extension
74
2
 
75
- end
3
+ def initialize(app, options_hash={}, &block)
4
+ super
5
+
6
+ # Require the library
7
+ require "compass"
76
8
 
77
- # A Compass Sass template for Tilt, adding our options in
78
- class CompassSassTemplate < ::Middleman::Renderers::Sass::SassPlusCSSFilenameTemplate
79
- def sass_options
80
- super.merge(::Compass.configuration.to_sass_engine_options)
9
+ # Hooks to manually update the compass config after we're
10
+ # done with it
11
+ app.define_hook :compass_config
12
+
13
+ # Location of SASS/SCSS files external to source directory.
14
+ # @return [Array]
15
+ # config[:sass_assets_paths] = ["#{root}/assets/sass/", "/path/2/external/sass/repository/"]
16
+ app.config.define_setting :sass_assets_paths, [], 'Paths to extra SASS/SCSS files'
17
+ end
18
+
19
+ def after_configuration
20
+ ::Compass.configuration do |compass_config|
21
+ compass_config.project_path = app.source_dir
22
+ compass_config.environment = :development
23
+ compass_config.cache_path = app.config[:sass_cache_path]
24
+ compass_config.sass_dir = app.config[:css_dir]
25
+ compass_config.css_dir = app.config[:css_dir]
26
+ compass_config.javascripts_dir = app.config[:js_dir]
27
+ compass_config.fonts_dir = app.config[:fonts_dir]
28
+ compass_config.images_dir = app.config[:images_dir]
29
+ compass_config.http_path = app.config[:http_prefix]
30
+
31
+ app.config[:sass_assets_paths].each do |path|
32
+ compass_config.add_import_path path
81
33
  end
34
+
35
+ # Disable this initially, the cache_buster extension will
36
+ # re-enable it if requested.
37
+ compass_config.asset_cache_buster :none
38
+
39
+ # Disable this initially, the relative_assets extension will
40
+
41
+ compass_config.relative_assets = false
42
+
43
+ # Default output style
44
+ compass_config.output_style = :nested
45
+
46
+ # No line-comments in test mode (changing paths mess with sha1)
47
+ compass_config.line_comments = false if ENV["TEST"]
82
48
  end
83
49
 
84
- # A Compass Scss template for Tilt, adding our options in
85
- class CompassScssTemplate < ::Middleman::Renderers::Sass::ScssPlusCSSFilenameTemplate
86
- def sass_options
87
- super.merge(::Compass.configuration.to_sass_engine_options)
88
- end
50
+ # Call hook
51
+ app.run_hook :compass_config, ::Compass.configuration
52
+
53
+ # Tell Tilt to use it as well (for inline sass blocks)
54
+ ::Tilt.register 'sass', CompassSassTemplate
55
+ ::Tilt.prefer(CompassSassTemplate)
56
+
57
+ # Tell Tilt to use it as well (for inline scss blocks)
58
+ ::Tilt.register 'scss', CompassScssTemplate
59
+ ::Tilt.prefer(CompassScssTemplate)
60
+ end
61
+
62
+ # A Compass Sass template for Tilt, adding our options in
63
+ class CompassSassTemplate < ::Middleman::Renderers::Sass::SassPlusCSSFilenameTemplate
64
+ def sass_options
65
+ super.merge(::Compass.configuration.to_sass_engine_options)
89
66
  end
67
+ end
90
68
 
69
+ # A Compass Scss template for Tilt, adding our options in
70
+ class CompassScssTemplate < ::Middleman::Renderers::Sass::ScssPlusCSSFilenameTemplate
71
+ def sass_options
72
+ super.merge(::Compass.configuration.to_sass_engine_options)
73
+ end
91
74
  end
92
- end
75
+ end