Module: Apropos
- Defined in:
- lib/apropos/functions.rb,
lib/apropos.rb,
lib/apropos/set.rb,
lib/apropos/variant.rb,
lib/apropos/version.rb,
lib/apropos/class_list.rb,
lib/apropos/media_query.rb,
lib/apropos/sass_functions.rb,
lib/apropos/extension_parser.rb
Overview
The Apropos module provides several functions for configuration and for supplying rules to the Sass functions. See the README for configuration examples.
It also provides convenience functions used by the Sass functions.
Defined Under Namespace
Modules: SassFunctions
Classes: ClassList, ExtensionParser, MediaQuery, Set, Variant
Constant Summary
collapse
- SEPARATOR =
'.'
- STYLESHEETS_DIR =
File.expand_path('../../stylesheets', __FILE__)
- VERSION =
"0.2.0"
- HIDPI_VARIANT_WARNING =
'DPI variant images detected in hidpi-only mode!'.freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.hidpi_only ⇒ Object
Returns the value of attribute hidpi_only.
10
11
12
|
# File 'lib/apropos/functions.rb', line 10
def hidpi_only
@hidpi_only
end
|
Class Method Details
.add_breakpoint_image_variant(id, query, order = 0) ⇒ Object
.add_class_image_variant(id, class_list = [], order = 0, &block) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/apropos/functions.rb', line 36
def add_class_image_variant(id, class_list=[], order=0, &block)
parser = if block_given?
lambda do |match|
result = block.call(match)
create_class_rule(result) if result
end
else
lambda do |match|
create_class_rule(class_list, order)
end
end
ExtensionParser.add_parser(id, &parser)
end
|
.add_dpi_image_variant(id, query, order = 0) ⇒ Object
.clear_image_variants ⇒ Object
56
57
58
|
# File 'lib/apropos/functions.rb', line 56
def clear_image_variants
ExtensionParser.parsers.clear
end
|
.convert_to_sass_value(val) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/apropos/functions.rb', line 65
def convert_to_sass_value(val)
case val
when String
Sass::Script::String.new(val)
when Array
converted = val.map {|element| convert_to_sass_value(element) }
Sass::Script::List.new(converted, :space)
else
raise "convert_to_sass_value doesn't understand type #{val.class.inspect}"
end
end
|
.create_class_rule(class_list, order = 0) ⇒ Object
51
52
53
54
|
# File 'lib/apropos/functions.rb', line 51
def create_class_rule(class_list, order=0)
list = Array(class_list).map {|name| name[0] == '.' ? name : ".#{name}"}
ClassList.new(list, order)
end
|
.image_set(path) ⇒ Object
15
16
17
|
# File 'lib/apropos/functions.rb', line 15
def image_set(path)
Set.new(path, images_dir)
end
|
.image_variant_rules(path) ⇒ Object
19
20
21
|
# File 'lib/apropos/functions.rb', line 19
def image_variant_rules(path)
image_set(path).valid_variants.map(&:rule)
end
|
.images_dir ⇒ Object
60
61
62
63
|
# File 'lib/apropos/functions.rb', line 60
def images_dir
config = Compass.configuration
Pathname.new(config.images_path || config.project_path)
end
|