Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-sass.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glex.spb@gmail.com>2014-07-12 20:22:59 +0400
committerGleb Mazovetskiy <glex.spb@gmail.com>2014-07-12 20:23:14 +0400
commitd5625c907168b6311be122b99d89614e02448475 (patch)
tree1cdfc580a9092fcdcfbec8b6e484a7f8244ebbcb
parentbfd047d7e2eec82e7e4a9996309f524d145b007d (diff)
better comment for $bootstrap-sass-asset-helper
[ci skip]
-rw-r--r--assets/stylesheets/bootstrap/_variables.scss7
-rw-r--r--tasks/converter/less_conversion.rb24
2 files changed, 17 insertions, 14 deletions
diff --git a/assets/stylesheets/bootstrap/_variables.scss b/assets/stylesheets/bootstrap/_variables.scss
index 9049d460..1abd52ee 100644
--- a/assets/stylesheets/bootstrap/_variables.scss
+++ b/assets/stylesheets/bootstrap/_variables.scss
@@ -1,7 +1,8 @@
-// a flag to toggle asset pipeline / compass integration
-// defaults to true if twbs-font-path function is present (no function => twbs-font-path('') parsed as string == right side)
-// in Sass 3.3 this can be improved with: function-exists(twbs-font-path)
+// When true, asset path helpers are used, otherwise regular url() is used
+// When there no function is defined, `fn('')` is parsed as string that equals the right hand side
+// NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
$bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")')) !default;
+
//
// Variables
// --------------------------------------------------
diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb
index 5dddfcfa..85938c19 100644
--- a/tasks/converter/less_conversion.rb
+++ b/tasks/converter/less_conversion.rb
@@ -88,18 +88,16 @@ class Converter
file = apply_mixin_parent_selector file, '\.(?:visible|hidden)'
when 'variables.less'
file = insert_default_vars(file)
- file = unindent <<-SCSS + file, 14
- // a flag to toggle asset pipeline / compass integration
- // defaults to true if twbs-font-path function is present (no function => twbs-font-path('') parsed as string == right side)
- // in Sass 3.3 this can be improved with: function-exists(twbs-font-path)
- $bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")')) !default;
+ file = unindent <<-SCSS + "\n" + file, 14
+ // When true, asset path helpers are used, otherwise regular `url()`` is used.
+ // When there no function is defined, `fn('')` is parsed as string that equals the right hand side
+ // NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
+ $bootstrap-sass-asset-helper: #{sass_fn_exists('twbs-font-path')} !default;
+ SCSS
+ file = replace_all file, %r{(\$icon-font-path): \s*"(.*)" (!default);}, "\n" + unindent(<<-SCSS, 14)
+ // [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths
+ \\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3;
SCSS
- file = replace_all file, %r{(\$icon-font-path): \s*"(.*)" (!default);}, <<-SCSS
-
-// [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths
-\\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3;
-SCSS
- '\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\2bootstrap/")\3'
when 'close.less'
# extract .close { button& {...} } rule
file = extract_nested_rule file, 'button&'
@@ -165,6 +163,10 @@ SCSS
file
end
+ def sass_fn_exists(fn)
+ %Q{(#{fn}("") != unquote('#{fn}("")'))}
+ end
+
def replace_asset_url(rule, type)
replace_all rule, /url\((.*?)\)/, "url(if($bootstrap-sass-asset-helper, twbs-#{type}-path(\\1), \\1))"
end