Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lvl99/b0e1caf7a1731b1c0ddfad9d4efbc157 to your computer and use it in GitHub Desktop.
Save lvl99/b0e1caf7a1731b1c0ddfad9d4efbc157 to your computer and use it in GitHub Desktop.
Object-oriented inspired composable LESS mixins. View the article on the blog: http://blog.lvl99.com
// Modal component
.modal {
.ui-lvl99-toggleable(@ns: ~“modal”);
.-toggleable-init-default();
}
// ... would generate the following CSS
.modal.ui-modal-show {
display: block;
}
.modal.ui-modal-hide {
display: none;
}
// Spinner component (could be used inline with text or in a button)
.spinner {
.ui-lvl99-toggleable(@ns: ~“spinner”; @-toggleable-display: ~”block”);
.-toggleable-init-default();
}
// ... would generate the following CSS
.spinner.ui-spinner-show {
display: inline-block;
}
.spinner.ui-spinner-hide {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment