[Docs] Make index pages that show all the available mixins and variables.
This commit is contained in:
parent
922fc8c1a2
commit
704eaea0b2
14
doc-src/content/index/mixins.haml
Normal file
14
doc-src/content/index/mixins.haml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: Compass Documentation | All Mixins
|
||||||
|
crumb: Docs
|
||||||
|
body_id: home
|
||||||
|
---
|
||||||
|
%article
|
||||||
|
%h1#logo Compass Mixins
|
||||||
|
|
||||||
|
- all_mixins.sort_by{|i| i.first.identifier}.each do |item, mixins|
|
||||||
|
%h3= link_to item[:title], item
|
||||||
|
%ul
|
||||||
|
- mixins.sort_by{|m| m.name}.each do |m|
|
||||||
|
%li= mixin_signature(m)
|
||||||
|
|
15
doc-src/content/index/variables.haml
Normal file
15
doc-src/content/index/variables.haml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: Compass Documentation | All Variables
|
||||||
|
crumb: Docs
|
||||||
|
body_id: home
|
||||||
|
---
|
||||||
|
%article
|
||||||
|
%h1#logo Compass Variables
|
||||||
|
|
||||||
|
- all_constants.sort_by{|i| i.first.identifier}.each do |item, constants|
|
||||||
|
%h3= link_to item[:title], item
|
||||||
|
%ul
|
||||||
|
- constants.sort_by{|c| c.name}.each do |c|
|
||||||
|
%li $#{c.name}
|
||||||
|
|
||||||
|
|
@ -139,6 +139,32 @@ def constants(item)
|
|||||||
constants
|
constants
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def all_constants
|
||||||
|
variables = []
|
||||||
|
@items.each do |item|
|
||||||
|
next unless item.identifier =~ %r{/reference}
|
||||||
|
next unless item[:stylesheet]
|
||||||
|
vars = constants(item)
|
||||||
|
if vars.any?
|
||||||
|
variables << [item, vars]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
variables
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_mixins
|
||||||
|
all_mixins = []
|
||||||
|
@items.each do |item|
|
||||||
|
next unless item.identifier =~ %r{/reference}
|
||||||
|
next unless item[:stylesheet]
|
||||||
|
ms = mixins(item)
|
||||||
|
if ms.any?
|
||||||
|
all_mixins << [item, ms]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
all_mixins
|
||||||
|
end
|
||||||
|
|
||||||
def mixin_signature(mixin, format = :html)
|
def mixin_signature(mixin, format = :html)
|
||||||
mixin.sass_signature(:none, format)
|
mixin.sass_signature(:none, format)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user