Assets Helper
HTML Markup
<div id="alert">
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Porro debitis odio nisi. Odit eligendi necessitatibus maxime ab deleniti in voluptatem, obcaecati exercitationem ducimus adipisci soluta hic laboriosam dolorem animi. Facere.
</p>
</div>
Creating CSS Rules
var AlertAssets = Object.assign({}, Assets);
AlertAssets.desktop("#alert", "background: red; color: white; padding: 100px;");
AlertAssets.tablet("#alert", "background: green; color: white; padding: 50px;");
AlertAssets.phone("#alert", "background: black; color: white; padding: 20px;");
AlertAssets.margin("#alert", {
top: 10, bottom: 20, right: 10, left: 15,
responsive: true,
tablet: {
top: 10, bottom: 20, right: 10, left: 15
},
phone: {
top: 10, bottom: 20, right: 10, left: 15
}
})
AlertAssets.padding("#alert", {
top: 10, bottom: 20, right: 10, left: 15,
responsive: true,
tablet: {
top: 10, bottom: 20, right: 10, left: 15
},
phone: {
top: 10, bottom: 20, right: 10, left: 15
}
})
AlertAssets.width('#alert', {
desktop: 20,
responsive: true,
tablet: 10,
phone: 18
})
AlertAssets.height('#alert', {
desktop: 20,
responsive: true,
tablet: 10,
phone: 18
})
Assets.height("#alert", 20)
AlertAssets.fontWeight('#alert', 'regular')
AlertAssets.fontSize("#alert", {
desktop: 20,
responsive: true,
tablet: 90,
phone: 80
})
AlertAssets.lineHeight("#alert", {
desktop: 10,
responsive: true,
tablet: 8,
phone: 5
})
AlertAssets.alignment("#alert", {
desktop: "left",
responsive: true,
tablet: "right",
phone: "center"
})
AlertAssets.float("#alert", {
desktop: "left",
responsive: true,
tablet: "right",
phone: "right"
})
AlertAssets.float("#alert", "left")
AlertAssets.hoverBoxShadow("#alert", {
hover_shadow_horizontal: 10,
hover_shadow_vertical: 20,
hover_shadow_vertical: 30,
hover_shadow_blur: 40,
hover_shadow_spread: 50,
hover_shadow_color: "blue",
hover_scale_enabled: true,
hover_shadow_scale: "1.5, 1.5"
})
AlertAssets.getHoverBoxShadow({
hover_shadow_horizontal: 10,
hover_shadow_vertical: 20,
hover_shadow_vertical: 30,
hover_shadow_blur: 40,
hover_shadow_spread: 50,
hover_shadow_color: "blue",
hover_scale_enabled: true,
hover_shadow_scale: "1.5, 1.5"
})
AlertAssets.typography("#alert", {
family: "arial",
size: 20,
weight: '100italic',
height: 2,
case: 'uppercase'
})
AlertAssets.image("images/info.png")
AlertAssets.load();
Template
<div id="alert-preview"></div>
<QuixTemplate id="alert-template">
<style>
body {
background: white
}
</style>
<QuixStyle>
// loading css ( JS WAY )
var alert = Object.assign({}, Assets);
alert.desktop("#alert-2", "background: {{ color }}");
</QuixStyle>
<QuixHtml>
<div id="alerts">
{% for alert in alerts %}
<div id="{{ alert }}">
<p>{{ alert }}</p>
</div>
{% endfor %}
</div>
</QuixHtml>
<QuixScript dependencies="
http://example.com/js/foo.js,
http://example.com/js/bar.js
">
// you have access jQuery and lodash :)
// $("#alert-1").html("updated element")
</QuixScript>
</QuixTemplate>
AlertAssets.render("#alert-template", {
alerts: ["alert-1", "alert-2"]
}, "#alert-preview");
License
This library is licensed under the MIT License