27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/jekyll/assets/plugins/alternates.rb', line 27
def call(input)
comp = input[:environment].asset_config[:compression]
data = Crass.parse(input[:data] || "", preserve_comments: true)
data.each do |v|
next unless v[:node] == :style_rule
v[:children] = v[:children].each_with_object([]) do |c, a|
if alternate?(c)
a << (comp ? NODE2 : NODE3)
a << NODE1
end
a << c
end
end
{
data: Crass::Parser.stringify(data, {
preserve_comments: true,
}),
}
end
|