tasks/converter.rb in patternfly-sass-2.6.0 vs tasks/converter.rb in patternfly-sass-2.7.0
- old
+ new
@@ -2,11 +2,11 @@
require "#{BOOTSTRAP_GEM_ROOT}/tasks/converter"
require 'pathname'
module Patternfly
class Converter < ::Converter
- BOOTSTRAP_LESS_ROOT = 'components/bootstrap/less'
+ BOOTSTRAP_LESS_ROOT = 'bower_components/bootstrap/less'
PATTERNFLY_LESS_ROOT = 'less'
PATTERNFLY_COMPONENTS = "../components/patternfly/components"
# Override
def initialize(options)
@@ -22,11 +22,11 @@
:scss => 'assets/stylesheets/patternfly',
:js => 'assets/javascripts',
:fonts => 'assets/fonts/patternfly'
}
@test_dir = options[:test_dir]
- get_trees(PATTERNFLY_LESS_ROOT, BOOTSTRAP_LESS_ROOT, 'tests', 'dist')
+ get_trees(PATTERNFLY_LESS_ROOT, 'tests', 'dist')
end
def process_patternfly
log_status "Convert Patternfly LESS to SASS"
puts " repo : #@repo_url"
@@ -99,17 +99,21 @@
""
end
when 'patternfly.less', 'bootstrap-touchspin.less', 'variables.less'
transforms = remove_xforms(transforms, :replace_spin)
when 'spinner.less'
- transforms = remove_xforms(transforms, :replace_spin, :replace_image_urls)
+ transforms = remove_xforms(transforms, :replace_spin)
end
file = convert_less(file, *transforms)
# Special cases go here
case name
+ when 'fonts.less', 'icons.less'
+ file = replace_rules(file, /\s*@font-face/) do |rule|
+ replace_asset_url rule, :font
+ end
when 'mixins.less'
NESTED_MIXINS.each do |selector, prefix|
file = flatten_mixins(file, selector, prefix)
end
file = replace_all(file, /,\s*\.open\s+\.dropdown-toggle& \{([^\{\}]*?)\}/m, " {\\1}\n .open & { &.dropdown-toggle {\\1} }")
@@ -318,14 +322,13 @@
def patternfly_less_files
get_paths_by_type('less', /\.less$/)
end
def load_shared
- mixin_hash = {}
- [BOOTSTRAP_LESS_ROOT, PATTERNFLY_LESS_ROOT].each do |root|
- mixin_hash[root] = read_files(
- get_paths_by_type(root, /mixins(\/)|(\.less)/)).values.join("\n")
- end
+ mixin_hash = {
+ BOOTSTRAP_LESS_ROOT => Dir["#{BOOTSTRAP_LESS_ROOT}/**/*.*"].select { |f| f =~ /mixins(\/)|(\.less)/ }.map { |f| File.read(f) }.join("\n"),
+ PATTERNFLY_LESS_ROOT => read_files(get_paths_by_type(PATTERNFLY_LESS_ROOT, /mixins(\/)|(\.less)/)).values.join("\n")
+ }
@shared_mixins ||= begin
read_mixins(mixin_hash.values.join("\n"), :nested => NESTED_MIXINS)
end
end