Download latest (or Prefixed - great with Bootstrap) | Get Started | Contribute | Documentation |
- Compiling LESS Hat is much more faster (up to 60× times).
- Here is a benchmark comparing LESS Hat 2.0.15 and LESS Hat 3. Thanks to Pixelass for this test.
- The main reason why LESS Hat 2.0.15 was so slow are LESS CSS Mixin Guards. LESS Hat used Mixin Guards for configurations browser prefixes. LESS Hat 3 dropped this feature. If you still want to use prefix configurations use LESS Hat 2.0.15. You can download it here.
- A lot of bug fixes...
Why LESS Hat? In August 2012, while we were developing and extending CSS Hat for LESS we needed universal mixins. Unfortunately, none of available were good enough that would satisfy our needs and that’s why we created new custom ones on our own, which have become the most popular mixin library for the whole LESS CSS.
After a year, there is a new, completely rewritten 3.0 version that brings 86 great mixins, robust workflow for editing, testing and creating new mixins.
Meet the best mixins library in the world. Thanks to the LESS Hat 3.0 is LESS CSS finally usable.
If you would like to use CSS Hat for working with LESS Hat and you still don't have one, we have a suprise for you at lesshat.com - Check it out!
Configuration – You can turn off/on browser prefixes according to your needs.LESS Hat 3.0 dropped this feature. Read more in 'What's new'.- No restrictions – If it's possible in CSS, it must be possible to be done with a mixin. Unlimited number of anything, shadows, gradients, gradient swatches.
- Standard naming convention – In LESS Hat, mixins have names like all CSS3 properties. No
.rounded
or.shadow
. It's stupid. - Cross-browser – LESS Hat takes care of exporting CSS for all available browsers.
- Bootstrap friendly – You can now use prefixed LESS Hat version and gaily work with Bootstrap. Yeah it's that easy.
- Keyframes – Although it's tricky as hell, but yeah LESS Hat has mixin for
.keyframes
- Blank state ready – If you call mixin without any arguments, LESS Hat does not pollute your CSS with empty properties. Instead LESS Hat generates nothing.
- Workflow – No more one line editing! We created developer friendly worklow for editing and creating mixins. You can test mixins with MOCHA, generate new mixin with GRUNT. Find out more about the workflow in contribution section.
The structure of this repo is:
- build folder – there are ready-to-use lesshat.less or lesshat-prefixed.less mixins
- mixins folder – developer version of mixins (more about that in contribution section)
- .gitignore – is a list of files that git will ignore. I know you know that, but it's convention.
- .travis.yml – Configuration file for Travis CI. Travis CI is a hosted continuous integration service for the open source community.
- Gruntfle.js – task runner. If you don't want to use lesshat-devstack ignore it.
- LICENSE – self-explanatory
- README-template.md – If you want to edit readme, edit it in this file. README.md is generated.
- README.md – please don't edit this file. Either edit README-template.md or documentation inside mixins/ folder.
- Bower – is like NPM for frontend. NPM is like Gems for JavaScript. I could go on forever…
- package.json – contains meta data for NPM.
-
Typical LESS Hat mixin:
.supermixin(...) { @process: ~`(function(){})()`; -webkit-border-radius: @process; border-radius: @process; }
In @process variable is all magic. Please don't edit javascrpt directly in .less file. Instead use lesshat-devstack.
-
Use (almost) every property without interpolation!
Correct mixin calling:
.background-image(linear-gradient(to bottom, #fb83fa 0%,#e93cec 100%))
Incorrect calling:
.background-image(~'linear-gradient(to bottom, #fb83fa 0%,#e93cec 100%)')
Unfortunately, there are exceptions:
.keyframes(~''); .calc(~''); .selection(~''); // in some cases you have to interpolate border-radius or LESS CSS begins to play on calculator .border-radius(~'20px / 40px');
- Download this repo.
- NPM install.
- Now you have LESS Hat devstack (see documentation.)
- If you create new mixin, use grunt generate command!
- If it's possible (almost always) test the coverage for new mixins, and never break existing tests.
- Commits should represent one logical change each. If a mixin goes through multiple iterations, squash your commits down to one.
- Finally, commit some code and open a pull request.
- align-content
flexbox
- align-items
flexbox
- align-self
flexbox
- animation
- animation-delay
- animation-direction
- animation-duration
- animation-fill-mode
- animation-iteration-count
- animation-name
- animation-play-state
- animation-timing-function
- appearance
- backface-visibility
- background-clip
- background-image
- background-origin
- background-size
- blur
filter
- border-bottom-left-radius
- border-bottom-right-radius
- border-image
- border-radius
- border-top-left-radius
- border-top-right-radius
- box-shadow
- box-sizing
- brightness
filter
- calc
- column-count
- column-gap
- column-rule
- column-width
- columns
- contrast
filter
- display
flexbox
- drop-shadow
filter
- filter
- flex
flexbox
- flex-basis
flexbox
- flex-direction
flexbox
- flex-grow
flexbox
- flex-shrink
flexbox
- flex-wrap
flexbox
- font-face
- grayscale
filter
- hue-rotate
filter
- hyphens
- invert
filter
- justify-content
flexbox
- keyframes
- opacity
- order
- perspective
- perspective-origin
- placeholder
- rotate
transform
- rotate3d
transform
- rotateX
transform
- rotateY
transform
- rotateZ
transform
- saturate
filter
- scale
transform
- scale3d
transform
- scaleX
transform
- scaleY
transform
- scaleZ
transform
- selection
- sepia
filter
- size
width, height
- skew
transform
- skewX
transform
- skewY
transform
- transform
- transform-origin
- transform-style
- transition
- transition-delay
- transition-duration
- transition-property
- transition-timing-function
- translate
transform
- translate3d
transform
- translateX
transform
- translateY
transform
- translateZ
transform
- user-select
{{ documentation }}
- Jan Kuca (help us with lesshat-devstack)
- MOZILLA DEVELOPER NETWORK (almost all summary are from MDN)
- CSS-Tricks (their CSS almanac is great resource)
- Angular UI router (example of good github profile)
- Marek Hrabe (for coding lesshat.com)
- Jan Vu Nam (for design lesshat.com and LESS Hat book icon)