diff --git a/README.md b/README.md index a38ff07a..f9546b7c 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,7 @@ Require the gem, and load paths and Sass helpers will be configured automaticall require 'bootstrap-sass' ``` -When using outside ruby (e.g. as a bower package), disable ruby asset lookup helper: - -```sass -$bootstrap-sass-asset-helper: false -``` - +You can use bootstrap-sass as a Bower package as well. #### JS and fonts diff --git a/lib/bootstrap-sass/sass_functions.rb b/lib/bootstrap-sass/sass_functions.rb index a78cc72c..0b88daf2 100644 --- a/lib/bootstrap-sass/sass_functions.rb +++ b/lib/bootstrap-sass/sass_functions.rb @@ -13,6 +13,7 @@ module Sass::Script::Functions declare :twbs_image_path, [:source] def twbs_asset_path(source, type) + return Sass::Script::String.new('', :string) if source.to_s.empty? url = if Bootstrap.asset_pipeline? && (context = sprockets_context) context.send(:"#{type}_path", source.value) elsif Bootstrap.compass? @@ -23,7 +24,7 @@ module Sass::Script::Functions url ||= source.value.gsub('"', '') Sass::Script::String.new(url, :string) end - declare :twbs_asset_path, [:source] + declare :twbs_asset_path, [:source, :type] unless Sass::Script::Functions.instance_methods.include?(:ie_hex_str) # polyfill sass < 3.2.6 (taken from sass 3.2.12): diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb index ea14f3e8..c088426c 100644 --- a/tasks/converter/less_conversion.rb +++ b/tasks/converter/less_conversion.rb @@ -74,8 +74,9 @@ class Converter when 'variables.less' file = insert_default_vars(file) file = <<-SCSS + file -// bootstrap specific variable. set to false if not using ruby + asset pipeline / compass. -$bootstrap-sass-asset-helper: true !default; +// whether to use bootstrap-sass asset pipeline / compass integration +// defaults to true if twbs-font-path function is present. +$bootstrap-sass-asset-helper: (twbs-font-path('') != unquote("twbs-font-path('')")) !default; SCSS file = replace_all file, /(\$icon-font-path:).*(!default)/, '\1 "bootstrap/" \2' when 'close.less' diff --git a/tasks/converter/network.rb b/tasks/converter/network.rb index d700c49f..1d118bc3 100644 --- a/tasks/converter/network.rb +++ b/tasks/converter/network.rb @@ -87,6 +87,7 @@ class Converter # get sha of the branch (= the latest commit) def get_branch_sha + return @branch if @branch =~ /[0-9a-f]+/ cmd = "git ls-remote '#@repo_url' | awk '/#@branch/ {print $1}'" puts cmd @branch_sha ||= %x[#{cmd}].chomp @@ -107,4 +108,4 @@ class Converter JSON.parse get_file(url) end end -end \ No newline at end of file +end diff --git a/vendor/assets/stylesheets/bootstrap/_variables.scss b/vendor/assets/stylesheets/bootstrap/_variables.scss index f4d2c2c2..6ea59615 100644 --- a/vendor/assets/stylesheets/bootstrap/_variables.scss +++ b/vendor/assets/stylesheets/bootstrap/_variables.scss @@ -1,5 +1,6 @@ -// bootstrap specific variable. set to false if not using ruby + asset pipeline / compass. -$bootstrap-sass-asset-helper: true !default; +// whether to use bootstrap-sass asset pipeline / compass integration +// defaults to true if twbs-font-path function is present. +$bootstrap-sass-asset-helper: (twbs-font-path('') != unquote("twbs-font-path('')")) !default; // // Variables // --------------------------------------------------