-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstylesheet_dsl.rb
More file actions
40 lines (33 loc) · 909 Bytes
/
stylesheet_dsl.rb
File metadata and controls
40 lines (33 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true
module Glug
# Defines the methods available to the DSL
class StylesheetDSL
def initialize(impl)
@__impl = impl
end
def layer(id, opts = {}, &block)
@__impl.layer(id, opts, &block)
end
def source(source_name, opts = {})
@__impl.source(source_name, opts)
end
def include_file(filename)
@__impl.include_file(filename)
end
def layer_order(order)
@__impl.layer_order(order)
end
# Arbitrary properties can be defined, e.g. "foo :bar" results in a top-level "foo":"bar" in the style
def respond_to_missing?(*)
true
end
# Set a property, e.g. 'bearing 29'
def method_missing(method_sym, *args)
if Layer::EXPRESSIONS.include?(method_sym)
Condition.new.from_list(method_sym, args)
else
@__impl.add_property(method_sym, *args)
end
end
end
end