middleman 0.14.1 → 0.99.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -18
- data/VERSION +1 -1
- data/features/automatic_image_sizes.feature +7 -7
- data/features/cache_buster.feature +10 -10
- data/features/minify_css.feature +10 -10
- data/features/minify_javascript.feature +6 -6
- data/features/step_definitions/asset_host_steps.rb +1 -0
- data/features/step_definitions/middleman_steps.rb +1 -1
- data/lib/middleman.rb +1 -18
- data/lib/middleman/assets.rb +33 -0
- data/lib/middleman/base.rb +25 -66
- data/lib/middleman/builder.rb +8 -4
- data/lib/middleman/features.rb +39 -0
- data/lib/middleman/features/asset_host.rb +16 -19
- data/lib/middleman/features/automatic_image_sizes.rb +24 -24
- data/lib/middleman/{fastimage.rb → features/automatic_image_sizes/fastimage.rb} +0 -0
- data/lib/middleman/features/cache_buster.rb +31 -38
- data/lib/middleman/{helpers.rb → features/default_helpers.rb} +8 -11
- data/lib/middleman/features/livereload.rb +19 -0
- data/lib/middleman/features/minify_css.rb +9 -0
- data/lib/middleman/features/minify_javascript.rb +15 -17
- data/lib/middleman/features/minify_javascript/rack.rb +31 -0
- data/lib/middleman/features/relative_assets.rb +29 -40
- data/lib/middleman/features/slickmap.rb +69 -70
- data/lib/middleman/features/smush_pngs.rb +8 -6
- data/lib/middleman/features/ugly_haml.rb +7 -0
- data/lib/middleman/renderers.rb +26 -0
- data/lib/middleman/renderers/coffee.rb +28 -0
- data/lib/middleman/renderers/haml.rb +2 -25
- data/lib/middleman/renderers/sass.rb +40 -87
- data/lib/middleman/template/init.rbt +30 -7
- data/middleman.gemspec +58 -69
- data/spec/builder_spec.rb +10 -4
- data/spec/fixtures/sample/views/stylesheets/site_scss.css.scss +1 -0
- data/spec/fixtures/sample/views/stylesheets/test_less.css.less +5 -0
- metadata +125 -113
- data/lib/middleman/rack/minify_css.rb +0 -25
- data/lib/middleman/rack/minify_javascript.rb +0 -25
- data/lib/middleman/rack/sprockets.rb +0 -61
- data/lib/middleman/renderers/builder.rb +0 -23
- data/lib/middleman/renderers/erb.rb +0 -24
- data/lib/middleman/renderers/less.rb +0 -23
- data/spec/fixtures/sample/public/javascripts/to-be-included.js +0 -1
- data/spec/fixtures/sample/views/javascripts/empty-with-include.js +0 -1
@@ -1,25 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require "yui/compressor"
|
3
|
-
rescue LoadError
|
4
|
-
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
|
5
|
-
end
|
6
|
-
|
7
|
-
class Middleman::Rack::MinifyCSS
|
8
|
-
def initialize(app, options={})
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
status, headers, response = @app.call(env)
|
14
|
-
|
15
|
-
if Middleman::Base.enabled?(:minify_css) && env["PATH_INFO"].match(/\.css$/)
|
16
|
-
compressor = ::YUI::CssCompressor.new
|
17
|
-
|
18
|
-
uncompressed_source = response.is_a?(::Rack::File) ? File.read(response.path) : response
|
19
|
-
response = compressor.compress(uncompressed_source)
|
20
|
-
headers["Content-Length"] = ::Rack::Utils.bytesize(response).to_s
|
21
|
-
end
|
22
|
-
|
23
|
-
[status, headers, response]
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require "yui/compressor"
|
3
|
-
rescue LoadError
|
4
|
-
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
|
5
|
-
end
|
6
|
-
|
7
|
-
class Middleman::Rack::MinifyJavascript
|
8
|
-
def initialize(app, options={})
|
9
|
-
@app = app
|
10
|
-
end
|
11
|
-
|
12
|
-
def call(env)
|
13
|
-
status, headers, response = @app.call(env)
|
14
|
-
|
15
|
-
if env["PATH_INFO"].match(/\.js$/)
|
16
|
-
compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
|
17
|
-
|
18
|
-
uncompressed_source = response.is_a?(::Rack::File) ? File.read(response.path) : response
|
19
|
-
response = compressor.compress(uncompressed_source)
|
20
|
-
headers["Content-Length"] = ::Rack::Utils.bytesize(response).to_s
|
21
|
-
end
|
22
|
-
|
23
|
-
[status, headers, response]
|
24
|
-
end
|
25
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'sprockets'
|
2
|
-
|
3
|
-
class Middleman::Rack::Sprockets
|
4
|
-
def initialize(app, options={})
|
5
|
-
@app = app
|
6
|
-
@options = options
|
7
|
-
end
|
8
|
-
|
9
|
-
def call(env)
|
10
|
-
if env["PATH_INFO"].match(/\.js$/)
|
11
|
-
public_file_path = File.join(Middleman::Base.public, env["PATH_INFO"])
|
12
|
-
view_file_path = File.join(Middleman::Base.views, env["PATH_INFO"])
|
13
|
-
|
14
|
-
source_file = Rack::File.new(Middleman::Base.public) if File.exists?(public_file_path)
|
15
|
-
source_file = Rack::File.new(Middleman::Base.views) if File.exists?(view_file_path)
|
16
|
-
|
17
|
-
if source_file
|
18
|
-
status, headers, response = source_file.call(env)
|
19
|
-
secretary = ::Sprockets::Secretary.new(@options.merge( :source_files => [ response.path ] ))
|
20
|
-
response = secretary.concatenation.to_s
|
21
|
-
headers["Content-Length"] = ::Rack::Utils.bytesize(response).to_s
|
22
|
-
return [status, headers, response]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
@app.call(env)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Middleman::Base.supported_formats << "js"
|
31
|
-
|
32
|
-
# Sprockets ruby 1.9 duckpunch
|
33
|
-
module Sprockets
|
34
|
-
class SourceFile
|
35
|
-
def source_lines
|
36
|
-
@lines ||= begin
|
37
|
-
lines = []
|
38
|
-
|
39
|
-
comments = []
|
40
|
-
File.open(pathname.absolute_location, 'rb') do |file|
|
41
|
-
file.each do |line|
|
42
|
-
lines << line = SourceLine.new(self, line, file.lineno)
|
43
|
-
|
44
|
-
if line.begins_pdoc_comment? || comments.any?
|
45
|
-
comments << line
|
46
|
-
end
|
47
|
-
|
48
|
-
if line.ends_multiline_comment?
|
49
|
-
if line.ends_pdoc_comment?
|
50
|
-
comments.each { |l| l.comment! }
|
51
|
-
end
|
52
|
-
comments.clear
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
lines
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "builder"
|
2
|
-
|
3
|
-
module Middleman
|
4
|
-
module Renderers
|
5
|
-
module Builder
|
6
|
-
def self.included(base)
|
7
|
-
base.supported_formats << "builder"
|
8
|
-
end
|
9
|
-
|
10
|
-
def render_path(path, layout)
|
11
|
-
if template_exists?(path, :builder)
|
12
|
-
builder(path.to_sym, :layout => layout)
|
13
|
-
else
|
14
|
-
super
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Middleman::Base
|
22
|
-
include Middleman::Renderers::Builder
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require "erb"
|
2
|
-
|
3
|
-
module Middleman
|
4
|
-
module Renderers
|
5
|
-
module ERb
|
6
|
-
def self.included(base)
|
7
|
-
base.supported_formats << "erb"
|
8
|
-
end
|
9
|
-
|
10
|
-
def render_path(path, layout)
|
11
|
-
if template_exists?(path, :erb)
|
12
|
-
layout = false if File.extname(path) == ".xml"
|
13
|
-
erb(path.to_sym, :layout => layout)
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Middleman::Base
|
23
|
-
include Middleman::Renderers::ERb
|
24
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "less"
|
2
|
-
|
3
|
-
module Middleman
|
4
|
-
module Renderers
|
5
|
-
module Less
|
6
|
-
def self.included(base)
|
7
|
-
base.supported_formats << "less"
|
8
|
-
end
|
9
|
-
|
10
|
-
def render_path(path, layout)
|
11
|
-
if template_exists?(path, :less)
|
12
|
-
less(path.to_sym)
|
13
|
-
else
|
14
|
-
super
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Middleman::Base
|
22
|
-
include Middleman::Renderers::Less
|
23
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
function() { return "combo"; };
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require <to-be-included>
|