Skip to content

Instantly share code, notes, and snippets.

@jensgro
Last active June 1, 2019 09:47
Show Gist options
  • Save jensgro/9f515b676ef2e75891ddb17b69192387 to your computer and use it in GitHub Desktop.
Save jensgro/9f515b676ef2e75891ddb17b69192387 to your computer and use it in GitHub Desktop.
module.exports =
content = [
{
"color": "primary",
"label": "primary Button"
},
{
"color": "secondary",
"label": "secondary Button"
},
{
"color": "success",
"label": "success Button"
},
{
"color": "info",
"label": "info Button"
},
{
"color": "warning",
"label": "warning Button"
},
{
"color": "danger",
"label": "danger Button"
},
{
"color": "light",
"label": "light Button"
},
{
"color": "dark",
"label": "darkButton"
},
{
"color": "link",
"label": "link Button"
}
]
<a href="#" class="btn btn-{{ color }}">{{ label }}</a>
module.exports = [
{
"color": "primary",
"label": "primary Button"
},
{
"color": "secondary",
"label": "secondary Button"
},
{
"color": "success",
"label": "success Button"
},
{
"color": "info",
"label": "info Button"
},
{
"color": "warning",
"label": "warning Button"
},
{
"color": "danger",
"label": "danger Button"
},
{
"color": "light",
"label": "light Button"
},
{
"color": "dark",
"label": "darkButton"
},
{
"color": "link",
"label": "link Button"
}
]
{
"content" : [
{
"color": "primary",
"label": "primary Button"
},
{
"color": "secondary",
"label": "secondary Button"
},
{
"color": "success",
"label": "success Button"
},
{
"color": "info",
"label": "info Button"
},
{
"color": "warning",
"label": "warning Button"
},
{
"color": "danger",
"label": "danger Button"
},
{
"color": "light",
"label": "light Button"
},
{
"color": "dark",
"label": "darkButton"
},
{
"color": "link",
"label": "link Button"
}
]
}
{% for item in content %}
<a href="#" class="btn btn-{{ item.color }}">{{ item.label }}</a>
{% endfor %}
@jensgro
Copy link
Author

jensgro commented Jun 1, 2019

Bei funktioniert-nicht.json wird ein "unexpected token" angemeckert, der Doppelpunkt:

`
button.data.js:2
"content" : [
^

SyntaxError: Unexpected token :
at createScript (vm.js:80:10)
`

@jensgro
Copy link
Author

jensgro commented Jun 1, 2019

Wenn ich aus "content": einfach content = mache, ist das syntaktisch korrekt, der Styleguide wird erzeugt, aber ich sehe keinen einzigen Button, der aus dem Array erzeugt werden sollte.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment