From 2b717ee3d4c7db870073e7d51fc9c8c83d08999b Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 21 Aug 2013 18:45:30 +0200 Subject: [PATCH] font helper broken attempt --- lib/bootstrap-sass/version.rb | 2 +- tasks/converter.rb | 10 +++++++++- vendor/assets/stylesheets/bootstrap/_glyphicons.scss | 10 +++++----- vendor/assets/stylesheets/bootstrap/_variables.scss | 3 +++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/bootstrap-sass/version.rb b/lib/bootstrap-sass/version.rb index f2411b89cd..42687b3a02 100644 --- a/lib/bootstrap-sass/version.rb +++ b/lib/bootstrap-sass/version.rb @@ -1,4 +1,4 @@ module Bootstrap VERSION = '3.0.0.0' - BOOTSTRAP_SHA = 'e143c3547241a1f92f54849ffbcb0745f3f8002c' + BOOTSTRAP_SHA = 'fee05d1f3e83e3d64a630879eea592e74e06820d' end diff --git a/tasks/converter.rb b/tasks/converter.rb index 75ae03b26b..4695b824fe 100644 --- a/tasks/converter.rb +++ b/tasks/converter.rb @@ -92,6 +92,7 @@ def process_stylesheet_assets when 'variables.less' file = insert_default_vars(file) file = replace_all file, /(\$icon-font-path:).*(!default)/, '\1 "bootstrap/" \2' + file = append_text file, "// [converter] injected var\n$twbs-font-url-helper: font-url !default;" when 'close.less' # extract .close { button& {...} } rule file = extract_nested_rule file, 'button&' @@ -112,7 +113,7 @@ def process_stylesheet_assets when 'glyphicons.less' file = replace_rules(file, '@font-face') { |rule| rule = replace_all rule, /(\$icon-font-\w+)/, '#{\1}' - replace_all rule, /url\(/, 'font-url(' + replace_all rule, /url\(/, '#{$twbs-font-url-helper}(' } end @@ -352,6 +353,7 @@ def replace_file_imports(less, target_path = 'bootstrap/') %Q(@import "#{target_path}\\1";) end + # logged gsub that raises when there is no match def replace_all(file, regex, replacement = nil, &block) log_transform regex, replacement new_file = file.gsub(regex, replacement, &block) @@ -359,6 +361,12 @@ def replace_all(file, regex, replacement = nil, &block) new_file end + # logged += + def append_text(file, text) + log_transform text + "#{file}\n#{text}" + end + # @mixin a() { tr& { color:white } } # to: # @mixin a($parent) { tr#{$parent} { color: white } } diff --git a/vendor/assets/stylesheets/bootstrap/_glyphicons.scss b/vendor/assets/stylesheets/bootstrap/_glyphicons.scss index 7614a7a502..b2de26e997 100644 --- a/vendor/assets/stylesheets/bootstrap/_glyphicons.scss +++ b/vendor/assets/stylesheets/bootstrap/_glyphicons.scss @@ -10,11 +10,11 @@ // Import the fonts @font-face { font-family: 'Glyphicons Halflings'; - src: font-url('#{$icon-font-path}#{$icon-font-name}.eot'); - src: font-url('#{$icon-font-path}#{$icon-font-name}.eot?#iefix') format('embedded-opentype'), - font-url('#{$icon-font-path}#{$icon-font-name}.woff') format('woff'), - font-url('#{$icon-font-path}#{$icon-font-name}.ttf') format('truetype'), - font-url('#{$icon-font-path}#{$icon-font-name}.svg#glyphicons-halflingsregular') format('svg'); + src: #{$twbs-font-url-helper}('#{$icon-font-path}#{$icon-font-name}.eot'); + src: #{$twbs-font-url-helper}('#{$icon-font-path}#{$icon-font-name}.eot?#iefix') format('embedded-opentype'), + #{$twbs-font-url-helper}('#{$icon-font-path}#{$icon-font-name}.woff') format('woff'), + #{$twbs-font-url-helper}('#{$icon-font-path}#{$icon-font-name}.ttf') format('truetype'), + #{$twbs-font-url-helper}('#{$icon-font-path}#{$icon-font-name}.svg#glyphicons-halflingsregular') format('svg'); } // Catchall baseclass diff --git a/vendor/assets/stylesheets/bootstrap/_variables.scss b/vendor/assets/stylesheets/bootstrap/_variables.scss index b47dd5b5f2..2565e2fc83 100644 --- a/vendor/assets/stylesheets/bootstrap/_variables.scss +++ b/vendor/assets/stylesheets/bootstrap/_variables.scss @@ -618,3 +618,6 @@ $container-desktop: ((940px + $grid-gutter-width)) !default; // Large screen / wide desktop $container-lg-desktop: ((1140px + $grid-gutter-width)) !default; + +// [converter] injected var +$twbs-font-url-helper: font-url !default; \ No newline at end of file