Skip to content

Instantly share code, notes, and snippets.

@abe33
Created February 13, 2015 14:08
Show Gist options
  • Save abe33/6a3528763b2b6b2a97c8 to your computer and use it in GitHub Desktop.
Save abe33/6a3528763b2b6b2a97c8 to your computer and use it in GitHub Desktop.
Styleguide Example
class StyleguideItemElement extends HTMLElement
createdCallback: ->
console.log 'here'
@shadowRoot = @createShadowRoot()
@contentContainer = document.createElement('div')
content = document.createElement('content')
content.setAttribute('select', '*')
@contentContainer.appendChild(content)
@shadowRoot.appendChild(@contentContainer)
pre = document.createElement('pre')
@codeContainer = document.createElement('code')
pre.appendChild(@codeContainer)
@shadowRoot.appendChild(pre)
contentTargets = @querySelectorAll('*')
sources = Array::map.call contentTargets, (el) -> el.outerHTML
@codeContainer.textContent = sources.join('\n')
StyleguideItemElement =
document.registerElement 'styleguide-item', prototype: StyleguideItemElement.prototype
styleguide-item
for color in ['default', 'primary', 'info', 'success', 'warning', 'danger']
button.btn(class="btn-#{color}")= color.replace(/^\w/, function(m){ return m.toUpperCase() })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment