mirror of
https://github.com/twbs/bootstrap-sass.git
synced 2022-11-09 12:27:02 -05:00
Sass: explicitly set $bootstrap-sass-asset-helper
Remove reliance on a hack as a polyfill for `function-exists`. Remove clutter from the generated variables template.
This commit is contained in:
parent
19651584e8
commit
7d30630bc8
6 changed files with 15 additions and 20 deletions
|
@ -5,3 +5,5 @@
|
|||
@function twbs-image-path($path) {
|
||||
@return image-url($path, true);
|
||||
}
|
||||
|
||||
$bootstrap-sass-asset-helper: true;
|
||||
|
|
|
@ -15,3 +15,5 @@
|
|||
@function twbs-image-path($file) {
|
||||
@return "<%- asset_path('#{$file}') %>";
|
||||
}
|
||||
|
||||
$bootstrap-sass-asset-helper: true;
|
||||
|
|
|
@ -5,3 +5,5 @@
|
|||
@function twbs-image-path($path) {
|
||||
@return image-path($path);
|
||||
}
|
||||
|
||||
$bootstrap-sass-asset-helper: true;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
// When true, asset path helpers are used, otherwise the regular CSS `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;
|
||||
|
||||
$bootstrap-sass-asset-helper: false !default;
|
||||
//
|
||||
// Variables
|
||||
// --------------------------------------------------
|
||||
|
@ -82,7 +78,8 @@ $headings-color: inherit !default;
|
|||
|
||||
//** Load fonts from this directory.
|
||||
|
||||
// [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths
|
||||
// [converter] If $bootstrap-sass-asset-helper if used, provide path relative to the assets load path.
|
||||
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
||||
$icon-font-path: if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/") !default;
|
||||
|
||||
//** File name for all font files.
|
||||
|
|
|
@ -95,14 +95,10 @@ class Converter
|
|||
file = apply_mixin_parent_selector file, '\.(?:visible|hidden)'
|
||||
when 'variables.less'
|
||||
file = insert_default_vars(file)
|
||||
file = unindent <<-SCSS + "\n" + file, 14
|
||||
// When true, asset path helpers are used, otherwise the regular CSS `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 = ['$bootstrap-sass-asset-helper: false !default;', file].join("\n")
|
||||
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
|
||||
// [converter] If $bootstrap-sass-asset-helper if used, provide path relative to the assets load path.
|
||||
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
||||
\\1: if($bootstrap-sass-asset-helper, "bootstrap/", "\\2bootstrap/") \\3;
|
||||
SCSS
|
||||
when 'close.less'
|
||||
|
@ -146,7 +142,7 @@ class Converter
|
|||
# generate variables template
|
||||
save_file 'templates/project/_bootstrap-variables.sass',
|
||||
"// Override Bootstrap variables here (defaults from bootstrap-sass v#{Bootstrap::VERSION}):\n\n" +
|
||||
File.read("#{save_to}/_variables.scss").gsub(/^(?=\$)/, '// ').gsub(/ !default;/, '')
|
||||
File.read("#{save_to}/_variables.scss").lines[1..-1].join.gsub(/^(?=\$)/, '// ').gsub(/ !default;/, '')
|
||||
end
|
||||
|
||||
def bootstrap_less_files
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
// Override Bootstrap variables here (defaults from bootstrap-sass v3.3.1.0):
|
||||
|
||||
// When true, asset path helpers are used, otherwise the regular CSS `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("")'))
|
||||
|
||||
//
|
||||
// Variables
|
||||
// --------------------------------------------------
|
||||
|
@ -84,7 +79,8 @@
|
|||
|
||||
//** Load fonts from this directory.
|
||||
|
||||
// [converter] Asset helpers such as Sprockets and Node.js Mincer do not resolve relative paths
|
||||
// [converter] If $bootstrap-sass-asset-helper if used, provide path relative to the assets load path.
|
||||
// [converter] This is because some asset helpers, such as Sprockets, do not work with file-relative paths.
|
||||
// $icon-font-path: if($bootstrap-sass-asset-helper, "bootstrap/", "../fonts/bootstrap/")
|
||||
|
||||
//** File name for all font files.
|
||||
|
|
Loading…
Add table
Reference in a new issue