This is a collection of Sublime Text shortcut snippets to enable quicker code commenting and Less variable conversion in Motif projects. Place these inside the Sublime Text Packages/User folder.
- Cheat Sheet
- Less/CSS Comments
- Less/CSS/JavaScript Comments (DocBlock-style)
- Less Variable Conversions
- HTML Comments
Other useful downloads:
- DocBlockr plugin (helps keep DocBlock-style comments going)
| Snippet | Tab Trigger |
|---|---|
| CSS Comment Section | *=== |
| CSS Comment Subsection | *___ |
| CSS/JS Comment | ** |
| CSS Comment: Variables | //var |
| CSS Comment: Extends | //ext |
| CSS Comment: Mixins | //mix |
| CSS Comment: Positioning | //pos |
| CSS Comment: Display & Box Model | //dis |
| CSS Comment: Other | //oth |
| Less Em Conversion | @# |
| Less Em Conversion (Alt) | @@ |
| Less New Base Text Size | @- |
| Less New Base Text Size (Alt) | @_ |
| HTML Comment Section | !=== |
| HTML Comment Subsection | !___ |
| HTML Comment Block | !-- |
Trigger: *===
As noted in Motif's CSS coding style guide:
/* ==========================================================================
[Section]
========================================================================== */Trigger: *___
As noted in Motif's CSS coding style guide:
/* [Subsection]
========================================================================== */Inline comments are used to group and organize the style properties in your stylesheets. (See the Motif coding style guide for declaration order.)
Trigger: //var
/* Vars */
@width: 20px;Trigger: //var
/* Extends */
&:extend(.class);Trigger: //mix
/* Mixins */
.m-clearfix();Trigger: //pos
/* Positioning */
position: absolute;
top: 0;
left: 50%;Trigger: //dis
/* Display & Box Model */
display: block;
margin: 0 auto;
padding: 20px;
width: @width;Trigger: //oth
/* Other */
font-size: 20px;
color: #000;
background: #fff;Put it all together:
.selector {
/* Vars */
@width: 20px;
/* Extends */
&:extend(.class);
/* Mixins */
.m-clearfix();
/* Display & Box Model */
display: block;
margin: 0 auto;
padding: 20px;
width: @width;
/* Positioning */
position: absolute;
top: 0;
left: 50%;
/* Other */
font-size: 20px;
color: #000;
background: #fff;
}Trigger: **
A DocBlock-style comment, as noted in Motif's CSS coding style guide:
/**
* [Sentence-case text]
*/Trigger: @#
A shortcut to bring up a formula to easily convert pixels to ems:
@[1]px: (1em * ([1] / [@base-text-size]));Trigger: @@
Same as above, only it doesn't assume the variable name will be a number:
@[name]: (1em * ([1] / [@base-text-size]));Trigger: @-
A shortcut to quickly set a new @base-text-size for the scope:
@base-text-size: [@normal]-text-size;Trigger: @_
Same as above, only it doesn't assume the variable will follow the @[name]-text-size pattern:
@base-text-size: [@normal-text-size];Trigger: !===
As noted in Motif's HTML coding style guide:
<!--
- ==========================================================================
- [Section]
- ==========================================================================
-->Trigger: !___
As noted in Motif's HTML coding style guide:
<!--
- [Subsection]
- ==========================================================================
-->Trigger: !--
As noted in Motif's HTML coding style guide:
<!--
- [Comment block]
-->