middleman-core 3.3.2 → 3.3.3
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 +4 -4
- data/features/helpers_select_tag.feature +6 -8
- data/lib/middleman-core.rb +1 -2
- data/lib/middleman-core/application.rb +10 -9
- data/lib/middleman-core/cli.rb +9 -13
- data/lib/middleman-core/cli/build.rb +26 -27
- data/lib/middleman-core/cli/bundler.rb +6 -7
- data/lib/middleman-core/cli/console.rb +10 -13
- data/lib/middleman-core/cli/extension.rb +2 -4
- data/lib/middleman-core/cli/init.rb +27 -28
- data/lib/middleman-core/cli/server.rb +43 -44
- data/lib/middleman-core/configuration.rb +13 -11
- data/lib/middleman-core/core_extensions/data.rb +21 -29
- data/lib/middleman-core/core_extensions/extensions.rb +8 -8
- data/lib/middleman-core/core_extensions/external_helpers.rb +3 -5
- data/lib/middleman-core/core_extensions/file_watcher.rb +7 -11
- data/lib/middleman-core/core_extensions/front_matter.rb +5 -6
- data/lib/middleman-core/core_extensions/rendering.rb +40 -30
- data/lib/middleman-core/core_extensions/request.rb +16 -19
- data/lib/middleman-core/core_extensions/routing.rb +37 -36
- data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -5
- data/lib/middleman-core/extension.rb +14 -16
- data/lib/middleman-core/extensions.rb +4 -6
- data/lib/middleman-core/load_paths.rb +3 -6
- data/lib/middleman-core/logger.rb +1 -3
- data/lib/middleman-core/meta_pages.rb +11 -11
- data/lib/middleman-core/meta_pages/config_setting.rb +4 -4
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +2 -2
- data/lib/middleman-core/meta_pages/sitemap_tree.rb +4 -4
- data/lib/middleman-core/preview_server.rb +12 -11
- data/lib/middleman-core/profiling.rb +6 -8
- data/lib/middleman-core/renderers/asciidoc.rb +12 -13
- data/lib/middleman-core/renderers/coffee_script.rb +2 -4
- data/lib/middleman-core/renderers/erb.rb +3 -4
- data/lib/middleman-core/renderers/haml.rb +2 -4
- data/lib/middleman-core/renderers/kramdown.rb +3 -4
- data/lib/middleman-core/renderers/less.rb +3 -9
- data/lib/middleman-core/renderers/liquid.rb +4 -8
- data/lib/middleman-core/renderers/markdown.rb +7 -11
- data/lib/middleman-core/renderers/redcarpet.rb +14 -16
- data/lib/middleman-core/renderers/sass.rb +36 -15
- data/lib/middleman-core/renderers/slim.rb +7 -10
- data/lib/middleman-core/renderers/stylus.rb +2 -6
- data/lib/middleman-core/sitemap.rb +6 -13
- data/lib/middleman-core/sitemap/extensions/ignores.rb +4 -10
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +3 -7
- data/lib/middleman-core/sitemap/extensions/proxies.rb +7 -12
- data/lib/middleman-core/sitemap/extensions/redirects.rb +7 -15
- data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +7 -15
- data/lib/middleman-core/sitemap/extensions/traversal.rb +4 -7
- data/lib/middleman-core/sitemap/queryable.rb +22 -27
- data/lib/middleman-core/sitemap/resource.rb +13 -25
- data/lib/middleman-core/sitemap/store.rb +11 -15
- data/lib/middleman-core/templates.rb +9 -12
- data/lib/middleman-core/templates/default.rb +6 -7
- data/lib/middleman-core/templates/empty.rb +0 -1
- data/lib/middleman-core/templates/extension/Gemfile +1 -1
- data/lib/middleman-core/templates/extension/Rakefile +2 -2
- data/lib/middleman-core/templates/extension/lib/lib.rb +0 -1
- data/lib/middleman-core/templates/html5.rb +6 -7
- data/lib/middleman-core/templates/local.rb +1 -2
- data/lib/middleman-core/templates/mobile.rb +3 -4
- data/lib/middleman-core/templates/shared/config.ru +1 -1
- data/lib/middleman-core/util.rb +5 -6
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/compass.rb +0 -1
- data/lib/middleman-more/core_extensions/default_helpers.rb +25 -16
- data/lib/middleman-more/core_extensions/i18n.rb +24 -23
- data/lib/middleman-more/extensions/asset_hash.rb +4 -6
- data/lib/middleman-more/extensions/asset_host.rb +1 -1
- data/lib/middleman-more/extensions/automatic_alt_tags.rb +2 -3
- data/lib/middleman-more/extensions/automatic_image_sizes.rb +4 -5
- data/lib/middleman-more/extensions/cache_buster.rb +0 -1
- data/lib/middleman-more/extensions/gzip.rb +1 -1
- data/lib/middleman-more/extensions/lorem.rb +8 -8
- data/lib/middleman-more/extensions/minify_css.rb +9 -8
- data/lib/middleman-more/extensions/minify_javascript.rb +5 -6
- data/lib/middleman-more/extensions/relative_assets.rb +0 -1
- data/lib/middleman-more/templates/smacss.rb +6 -7
- data/middleman-core.gemspec +1 -1
- metadata +5 -5
|
@@ -4,16 +4,15 @@ module Middleman
|
|
|
4
4
|
module Renderers
|
|
5
5
|
module AsciiDoc
|
|
6
6
|
class << self
|
|
7
|
-
|
|
8
7
|
def registered(app)
|
|
9
8
|
app.config.define_setting :asciidoc, {
|
|
10
|
-
:
|
|
11
|
-
:
|
|
12
|
-
:
|
|
9
|
+
safe: :safe,
|
|
10
|
+
backend: :html5,
|
|
11
|
+
attributes: %W(showtitle env=middleman env-middleman middleman-version=#{::Middleman::VERSION})
|
|
13
12
|
}, 'AsciiDoc engine options (Hash)'
|
|
14
13
|
app.config.define_setting :asciidoc_attributes, [], 'AsciiDoc custom attributes (Array)'
|
|
15
14
|
app.before_configuration do
|
|
16
|
-
template_extensions :
|
|
15
|
+
template_extensions adoc: :html
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
app.after_configuration do
|
|
@@ -24,7 +23,7 @@ module Middleman
|
|
|
24
23
|
sitemap.provides_metadata(/\.adoc$/) do |path|
|
|
25
24
|
# read the AsciiDoc header only to set page options and data
|
|
26
25
|
# header values can be accessed via app.data.page.<name> in the layout
|
|
27
|
-
doc = Asciidoctor.load_file path, :
|
|
26
|
+
doc = Asciidoctor.load_file path, safe: :safe, parse_header_only: true
|
|
28
27
|
|
|
29
28
|
opts = {}
|
|
30
29
|
if doc.attr? 'page-layout'
|
|
@@ -35,24 +34,24 @@ module Middleman
|
|
|
35
34
|
opts[:layout] = layout
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
|
-
opts[:layout_engine] = (doc.attr 'page-layout-engine') if
|
|
39
|
-
# TODO override attributes to set docfile, docdir, docname, etc
|
|
37
|
+
opts[:layout_engine] = (doc.attr 'page-layout-engine') if doc.attr? 'page-layout-engine'
|
|
38
|
+
# TODO: override attributes to set docfile, docdir, docname, etc
|
|
40
39
|
# alternative is to set :renderer_options, which get merged into options by the rendering extension
|
|
41
|
-
#opts[:attributes] = config[:asciidoc][:attributes].dup
|
|
42
|
-
#opts[:attributes].concat %W(docfile=#{path} docdir=#{File.dirname path} docname=#{(File.basename path).sub(/\.adoc$/, '')})
|
|
40
|
+
# opts[:attributes] = config[:asciidoc][:attributes].dup
|
|
41
|
+
# opts[:attributes].concat %W(docfile=#{path} docdir=#{File.dirname path} docname=#{(File.basename path).sub(/\.adoc$/, '')})
|
|
43
42
|
|
|
44
43
|
page = {}
|
|
45
44
|
page[:title] = doc.doctitle
|
|
46
45
|
page[:date] = (doc.attr 'date') unless (doc.attr 'date').nil?
|
|
47
|
-
# TODO grab all the author information
|
|
46
|
+
# TODO: grab all the author information
|
|
48
47
|
page[:author] = (doc.attr 'author') unless (doc.attr 'author').nil?
|
|
49
48
|
|
|
50
|
-
{:
|
|
49
|
+
{ options: opts, page: ::Middleman::Util.recursively_enhance(page) }
|
|
51
50
|
end
|
|
52
51
|
end
|
|
53
52
|
end
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
alias_method :included, :registered
|
|
56
55
|
end
|
|
57
56
|
end
|
|
58
57
|
end
|
|
@@ -3,10 +3,8 @@ require 'coffee_script'
|
|
|
3
3
|
|
|
4
4
|
module Middleman
|
|
5
5
|
module Renderers
|
|
6
|
-
|
|
7
6
|
# CoffeeScript Renderer
|
|
8
7
|
module CoffeeScript
|
|
9
|
-
|
|
10
8
|
# Setup extension
|
|
11
9
|
class << self
|
|
12
10
|
# Once registered
|
|
@@ -16,11 +14,11 @@ module Middleman
|
|
|
16
14
|
::Tilt.prefer(DebuggingCoffeeScriptTemplate)
|
|
17
15
|
|
|
18
16
|
app.before_configuration do
|
|
19
|
-
template_extensions :
|
|
17
|
+
template_extensions coffee: :js
|
|
20
18
|
DebuggingCoffeeScriptTemplate.middleman_app = self
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
|
-
|
|
21
|
+
alias_method :included, :registered
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
# A Template for Tilt which outputs debug messages
|
|
@@ -4,11 +4,10 @@ module Middleman
|
|
|
4
4
|
module ERb
|
|
5
5
|
# Setup extension
|
|
6
6
|
class << self
|
|
7
|
-
|
|
8
7
|
# once registered
|
|
9
8
|
def registered(app)
|
|
10
9
|
app.before_configuration do
|
|
11
|
-
template_extensions :
|
|
10
|
+
template_extensions erb: :html
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
# After config
|
|
@@ -16,7 +15,7 @@ module Middleman
|
|
|
16
15
|
::Tilt.prefer(Template, :erb)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
|
-
|
|
18
|
+
alias_method :included, :registered
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
class Template < ::Tilt::ErubisTemplate
|
|
@@ -26,7 +25,7 @@ module Middleman
|
|
|
26
25
|
def precompiled_preamble(locals)
|
|
27
26
|
original = super
|
|
28
27
|
"__in_erb_template = true\n" << original
|
|
29
|
-
|
|
28
|
+
# .rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
end
|
|
@@ -13,16 +13,14 @@ end
|
|
|
13
13
|
|
|
14
14
|
module Middleman
|
|
15
15
|
module Renderers
|
|
16
|
-
|
|
17
16
|
# Haml Renderer
|
|
18
17
|
module Haml
|
|
19
|
-
|
|
20
18
|
# Setup extension
|
|
21
19
|
class << self
|
|
22
20
|
# Once registered
|
|
23
21
|
def registered(app)
|
|
24
22
|
app.before_configuration do
|
|
25
|
-
template_extensions :
|
|
23
|
+
template_extensions haml: :html
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
# Add haml helpers to context
|
|
@@ -33,7 +31,7 @@ module Middleman
|
|
|
33
31
|
init_haml_helpers
|
|
34
32
|
end
|
|
35
33
|
end
|
|
36
|
-
|
|
34
|
+
alias_method :included, :registered
|
|
37
35
|
end
|
|
38
36
|
end
|
|
39
37
|
end
|
|
@@ -2,10 +2,9 @@ require 'kramdown'
|
|
|
2
2
|
|
|
3
3
|
module Middleman
|
|
4
4
|
module Renderers
|
|
5
|
-
|
|
6
5
|
# Our own Kramdown Tilt template that simply uses our custom renderer.
|
|
7
6
|
class KramdownTemplate < ::Tilt::KramdownTemplate
|
|
8
|
-
def evaluate(
|
|
7
|
+
def evaluate(*)
|
|
9
8
|
@output ||= begin
|
|
10
9
|
output, warnings = MiddlemanKramdownHTML.convert(@engine.root, @engine.options)
|
|
11
10
|
@engine.warnings.concat(warnings)
|
|
@@ -18,7 +17,7 @@ module Middleman
|
|
|
18
17
|
class MiddlemanKramdownHTML < ::Kramdown::Converter::Html
|
|
19
18
|
cattr_accessor :middleman_app
|
|
20
19
|
|
|
21
|
-
def convert_img(el,
|
|
20
|
+
def convert_img(el, _)
|
|
22
21
|
attrs = el.attr.dup
|
|
23
22
|
|
|
24
23
|
link = attrs.delete('src')
|
|
@@ -32,7 +31,7 @@ module Middleman
|
|
|
32
31
|
mail_addr = el.attr['href'].sub(/\Amailto:/, '')
|
|
33
32
|
href = obfuscate('mailto') << ':' << obfuscate(mail_addr)
|
|
34
33
|
content = obfuscate(content) if content == mail_addr
|
|
35
|
-
return %Q
|
|
34
|
+
return %Q(<a href="#{href}">#{content}</a>)
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
attr = el.attr.dup
|
|
@@ -2,20 +2,17 @@ require 'less'
|
|
|
2
2
|
|
|
3
3
|
module Middleman
|
|
4
4
|
module Renderers
|
|
5
|
-
|
|
6
5
|
# Sass renderer
|
|
7
6
|
module Less
|
|
8
|
-
|
|
9
7
|
# Setup extension
|
|
10
8
|
class << self
|
|
11
|
-
|
|
12
9
|
# Once registered
|
|
13
10
|
def registered(app)
|
|
14
11
|
# Default less options
|
|
15
12
|
app.config.define_setting :less, {}, 'LESS compiler options'
|
|
16
13
|
|
|
17
14
|
app.before_configuration do
|
|
18
|
-
template_extensions :
|
|
15
|
+
template_extensions less: :css
|
|
19
16
|
end
|
|
20
17
|
|
|
21
18
|
app.after_configuration do
|
|
@@ -27,23 +24,20 @@ module Middleman
|
|
|
27
24
|
::Tilt.prefer(LocalLoadingLessTemplate)
|
|
28
25
|
end
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
alias_method :included, :registered
|
|
31
28
|
end
|
|
32
29
|
|
|
33
30
|
# A SassTemplate for Tilt which outputs debug messages
|
|
34
31
|
class LocalLoadingLessTemplate < ::Tilt::LessTemplate
|
|
35
|
-
|
|
36
32
|
def prepare
|
|
37
33
|
if ::Less.const_defined? :Engine
|
|
38
34
|
@engine = ::Less::Engine.new(data)
|
|
39
35
|
else
|
|
40
|
-
parser = ::Less::Parser.new(options.merge :
|
|
36
|
+
parser = ::Less::Parser.new(options.merge filename: eval_file, line: line, paths: ['.', File.dirname(eval_file)])
|
|
41
37
|
@engine = parser.parse(data)
|
|
42
38
|
end
|
|
43
39
|
end
|
|
44
|
-
|
|
45
40
|
end
|
|
46
|
-
|
|
47
41
|
end
|
|
48
42
|
end
|
|
49
43
|
end
|
|
@@ -3,17 +3,14 @@ require 'liquid'
|
|
|
3
3
|
|
|
4
4
|
module Middleman
|
|
5
5
|
module Renderers
|
|
6
|
-
|
|
7
6
|
# Liquid Renderer
|
|
8
7
|
module Liquid
|
|
9
|
-
|
|
10
8
|
# Setup extension
|
|
11
9
|
class << self
|
|
12
|
-
|
|
13
10
|
# Once registerd
|
|
14
11
|
def registered(app)
|
|
15
12
|
app.before_configuration do
|
|
16
|
-
template_extensions :
|
|
13
|
+
template_extensions liquid: :html
|
|
17
14
|
end
|
|
18
15
|
|
|
19
16
|
# After config, setup liquid partial paths
|
|
@@ -21,15 +18,14 @@ module Middleman
|
|
|
21
18
|
::Liquid::Template.file_system = ::Liquid::LocalFileSystem.new(source_dir)
|
|
22
19
|
|
|
23
20
|
# Convert data object into a hash for liquid
|
|
24
|
-
sitemap.provides_metadata %r{\.liquid$} do
|
|
25
|
-
{ :
|
|
21
|
+
sitemap.provides_metadata %r{\.liquid$} do
|
|
22
|
+
{ locals: { data: data.to_h } }
|
|
26
23
|
end
|
|
27
24
|
end
|
|
28
25
|
end
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
alias_method :included, :registered
|
|
31
28
|
end
|
|
32
29
|
end
|
|
33
|
-
|
|
34
30
|
end
|
|
35
31
|
end
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
module Middleman
|
|
2
2
|
module Renderers
|
|
3
|
-
|
|
4
3
|
# Markdown renderer
|
|
5
4
|
module Markdown
|
|
6
|
-
|
|
7
5
|
# Setup extension
|
|
8
6
|
class << self
|
|
9
|
-
|
|
10
7
|
# Once registered
|
|
11
8
|
def registered(app)
|
|
12
9
|
# Set our preference for a markdown engine
|
|
@@ -14,11 +11,11 @@ module Middleman
|
|
|
14
11
|
app.config.define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines'
|
|
15
12
|
|
|
16
13
|
app.before_configuration do
|
|
17
|
-
template_extensions :
|
|
18
|
-
:
|
|
19
|
-
:
|
|
20
|
-
:
|
|
21
|
-
:
|
|
14
|
+
template_extensions markdown: :html,
|
|
15
|
+
mdown: :html,
|
|
16
|
+
md: :html,
|
|
17
|
+
mkd: :html,
|
|
18
|
+
mkdn: :html
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
# Once configuration is parsed
|
|
@@ -35,7 +32,7 @@ module Middleman
|
|
|
35
32
|
require 'middleman-core/renderers/kramdown'
|
|
36
33
|
::Tilt.prefer(::Middleman::Renderers::KramdownTemplate, *markdown_exts)
|
|
37
34
|
MiddlemanKramdownHTML.middleman_app = self
|
|
38
|
-
elsif
|
|
35
|
+
elsif config[:markdown_engine]
|
|
39
36
|
# Map symbols to classes
|
|
40
37
|
markdown_engine_klass = if config[:markdown_engine].is_a? Symbol
|
|
41
38
|
engine = config[:markdown_engine].to_s
|
|
@@ -58,9 +55,8 @@ module Middleman
|
|
|
58
55
|
end
|
|
59
56
|
end
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
alias_method :included, :registered
|
|
62
59
|
end
|
|
63
60
|
end
|
|
64
|
-
|
|
65
61
|
end
|
|
66
62
|
end
|
|
@@ -2,20 +2,18 @@ require 'redcarpet'
|
|
|
2
2
|
|
|
3
3
|
module Middleman
|
|
4
4
|
module Renderers
|
|
5
|
-
|
|
6
5
|
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate::Redcarpet2
|
|
7
|
-
|
|
8
6
|
# because tilt has decided to convert these
|
|
9
7
|
# in the wrong direction
|
|
10
8
|
ALIASES = {
|
|
11
|
-
:
|
|
9
|
+
escape_html: :filter_html
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
# Overwrite built-in Tilt version.
|
|
15
13
|
# Don't overload :renderer option with smartypants
|
|
16
14
|
# Support renderer-level options
|
|
17
15
|
def generate_renderer
|
|
18
|
-
return options.delete(:renderer) if options.
|
|
16
|
+
return options.delete(:renderer) if options.key?(:renderer)
|
|
19
17
|
|
|
20
18
|
covert_options_to_aliases!
|
|
21
19
|
|
|
@@ -32,8 +30,8 @@ module Middleman
|
|
|
32
30
|
# Renderer Options
|
|
33
31
|
possible_render_opts = [:filter_html, :no_images, :no_links, :no_styles, :safe_links_only, :with_toc_data, :hard_wrap, :xhtml, :prettify, :link_attributes]
|
|
34
32
|
|
|
35
|
-
render_options = possible_render_opts.
|
|
36
|
-
sum[opt] = options.delete(opt) if options.
|
|
33
|
+
render_options = possible_render_opts.reduce({}) do |sum, opt|
|
|
34
|
+
sum[opt] = options.delete(opt) if options.key?(opt)
|
|
37
35
|
sum
|
|
38
36
|
end
|
|
39
37
|
|
|
@@ -42,11 +40,11 @@ module Middleman
|
|
|
42
40
|
|
|
43
41
|
private
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
43
|
+
def covert_options_to_aliases!
|
|
44
|
+
ALIASES.each do |aka, actual|
|
|
45
|
+
options[actual] = options.delete(aka) if options.key? aka
|
|
49
46
|
end
|
|
47
|
+
end
|
|
50
48
|
end
|
|
51
49
|
|
|
52
50
|
# Custom Redcarpet renderer that uses our helpers for images and links
|
|
@@ -61,23 +59,23 @@ module Middleman
|
|
|
61
59
|
|
|
62
60
|
def image(link, title, alt_text)
|
|
63
61
|
if !@local_options[:no_images]
|
|
64
|
-
middleman_app.image_tag(link, :
|
|
62
|
+
middleman_app.image_tag(link, title: title, alt: alt_text)
|
|
65
63
|
else
|
|
66
64
|
link_string = link.dup
|
|
67
|
-
link_string << %Q
|
|
65
|
+
link_string << %Q("#{title}") if title && title.length > 0 && title != alt_text
|
|
68
66
|
%Q{}
|
|
69
67
|
end
|
|
70
68
|
end
|
|
71
69
|
|
|
72
70
|
def link(link, title, content)
|
|
73
71
|
if !@local_options[:no_links]
|
|
74
|
-
attributes = { :
|
|
75
|
-
attributes.merge!(
|
|
72
|
+
attributes = { title: title }
|
|
73
|
+
attributes.merge!(@local_options[:link_attributes]) if @local_options[:link_attributes]
|
|
76
74
|
|
|
77
|
-
middleman_app.link_to(content, link, attributes
|
|
75
|
+
middleman_app.link_to(content, link, attributes)
|
|
78
76
|
else
|
|
79
77
|
link_string = link.dup
|
|
80
|
-
link_string << %Q
|
|
78
|
+
link_string << %Q("#{title}") if title && title.length > 0 && title != alt_text
|
|
81
79
|
%Q{[#{content}](#{link_string})}
|
|
82
80
|
end
|
|
83
81
|
end
|
|
@@ -1,23 +1,49 @@
|
|
|
1
1
|
require 'sass'
|
|
2
2
|
require 'compass/import-once'
|
|
3
3
|
|
|
4
|
+
GLOB = /\*|\[.+\]/
|
|
5
|
+
|
|
6
|
+
# Hack around broken sass globs when combined with import-once
|
|
7
|
+
# Targets compass-import-once 1.0.4
|
|
8
|
+
# Tracking issue: https://github.com/chriseppstein/compass/issues/1529
|
|
9
|
+
module Compass
|
|
10
|
+
module ImportOnce
|
|
11
|
+
module Importer
|
|
12
|
+
def find_relative(uri, base, options, *args)
|
|
13
|
+
if uri =~ GLOB
|
|
14
|
+
force_import = true
|
|
15
|
+
else
|
|
16
|
+
uri, force_import = handle_force_import(uri)
|
|
17
|
+
end
|
|
18
|
+
maybe_replace_with_dummy_engine(super(uri, base, options, *args), options, force_import)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def find(uri, options, *args)
|
|
22
|
+
if uri =~ GLOB
|
|
23
|
+
force_import = true
|
|
24
|
+
else
|
|
25
|
+
uri, force_import = handle_force_import(uri)
|
|
26
|
+
end
|
|
27
|
+
maybe_replace_with_dummy_engine(super(uri, options, *args), options, force_import)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
4
33
|
module Middleman
|
|
5
34
|
module Renderers
|
|
6
|
-
|
|
7
35
|
# Sass renderer
|
|
8
36
|
module Sass
|
|
9
|
-
|
|
10
37
|
# Setup extension
|
|
11
38
|
class << self
|
|
12
|
-
|
|
13
39
|
# Once registered
|
|
14
40
|
def registered(app)
|
|
15
41
|
# Default sass options
|
|
16
42
|
app.config.define_setting :sass, {}, 'Sass engine options'
|
|
17
43
|
|
|
18
44
|
app.before_configuration do
|
|
19
|
-
template_extensions :
|
|
20
|
-
:
|
|
45
|
+
template_extensions scss: :css,
|
|
46
|
+
sass: :css
|
|
21
47
|
end
|
|
22
48
|
|
|
23
49
|
# Tell Tilt to use it as well (for inline sass blocks)
|
|
@@ -31,18 +57,15 @@ module Middleman
|
|
|
31
57
|
::Compass::ImportOnce.activate!
|
|
32
58
|
end
|
|
33
59
|
|
|
34
|
-
|
|
60
|
+
alias_method :included, :registered
|
|
35
61
|
end
|
|
36
62
|
|
|
37
63
|
# A SassTemplate for Tilt which outputs debug messages
|
|
38
64
|
class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
|
|
39
|
-
|
|
40
65
|
def initialize(*args, &block)
|
|
41
66
|
super
|
|
42
67
|
|
|
43
|
-
if @options.
|
|
44
|
-
@context = @options[:context]
|
|
45
|
-
end
|
|
68
|
+
@context = @options[:context] if @options.key?(:context)
|
|
46
69
|
end
|
|
47
70
|
|
|
48
71
|
# Define the expected syntax for the template
|
|
@@ -55,23 +78,22 @@ module Middleman
|
|
|
55
78
|
|
|
56
79
|
# Add exception messaging
|
|
57
80
|
# @param [Class] context
|
|
58
|
-
# @param [Hash] locals
|
|
59
81
|
# @return [String]
|
|
60
|
-
def evaluate(context,
|
|
82
|
+
def evaluate(context, _)
|
|
61
83
|
@context ||= context
|
|
62
84
|
@engine = ::Sass::Engine.new(data, sass_options)
|
|
63
85
|
|
|
64
86
|
begin
|
|
65
87
|
@engine.render
|
|
66
88
|
rescue ::Sass::SyntaxError => e
|
|
67
|
-
::Sass::SyntaxError.exception_to_css(e, :
|
|
89
|
+
::Sass::SyntaxError.exception_to_css(e, full_exception: true)
|
|
68
90
|
end
|
|
69
91
|
end
|
|
70
92
|
|
|
71
93
|
# Change Sass path, for url functions, to the build folder if we're building
|
|
72
94
|
# @return [Hash]
|
|
73
95
|
def sass_options
|
|
74
|
-
more_opts = { :
|
|
96
|
+
more_opts = { filename: eval_file, line: line, syntax: syntax }
|
|
75
97
|
|
|
76
98
|
if @context.is_a?(::Middleman::Application) && file
|
|
77
99
|
location_of_sass_file = @context.source_dir
|
|
@@ -87,7 +109,6 @@ module Middleman
|
|
|
87
109
|
|
|
88
110
|
# SCSS version of the above template
|
|
89
111
|
class ScssPlusCSSFilenameTemplate < SassPlusCSSFilenameTemplate
|
|
90
|
-
|
|
91
112
|
# Define the expected syntax for the template
|
|
92
113
|
# @return [Symbol]
|
|
93
114
|
def syntax
|