Coder Social home page Coder Social logo

lesshat's Introduction

lesshat Build Status

lesshat Analytics


Download latest | Get Started | Introduction | Contribute | Documentation |


Current version: v4.1.0 (2016-07-19)

Get started

To use lesshat, you need node/npm installed then run npm install lesshat --save to install and save lesshat into your package.json. From here, you just need to reference the node_modules/lesshat/lesshat.less within your .less stylesheets.

Bower

Introduction

Why lesshat? 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.

Meet the best mixins library in the world.

Features

  • 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 lesshat, mixins have names like all CSS3 properties. No .rounded or .shadow. It's stupid.
  • Cross-browser – lesshat takes care of exporting CSS for all available browsers.
  • Bootstrap friendly – You can now use prefixed lesshat version and gaily work with Bootstrap. Yeah it's that easy.
  • Keyframes – Although it's tricky as hell, but yeah lesshat has mixin for .keyframes
  • Blank state ready – If you call mixin without any arguments, lesshat does not pollute your CSS with empty properties. Instead lesshat generates nothing.
  • WorkflowNo 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 Contribute section.

Structure of lesshat mixins

  1. Typical lesshat mixin:

     .supermixin(...) {
     	@process: ~`(function(){})()`;
    
     	-webkit-border-radius: @process;
     	border-radius: @process;
     }
    

    In @process variable is all magic. Please don't edit javascript directly in .less file. Instead use lesshat-devstack.

  2. 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');
    

Contribute:

  1. Download this repo.
  2. NPM install.
  3. Now you have lesshat devstack (see documentation.)
  4. If you create new mixin, use grunt generate command!
  5. If it's possible (almost always) test the coverage for new mixins, and never break existing tests.
  6. Commits should represent one logical change each. If a mixin goes through multiple iterations, squash your commits down to one.
  7. Finally, commit some code and open a pull request.

Documentation:

List of mixins:

  1. align-content flexbox
  2. align-items flexbox
  3. align-self flexbox
  4. animation
  5. animation-delay
  6. animation-direction
  7. animation-duration
  8. animation-fill-mode
  9. animation-iteration-count
  10. animation-name
  11. animation-play-state
  12. animation-timing-function
  13. appearance
  14. backface-visibility
  15. background-clip
  16. background-image
  17. background-origin
  18. background-size
  19. blur filter
  20. border-bottom-left-radius
  21. border-bottom-right-radius
  22. border-image
  23. border-radius
  24. border-top-left-radius
  25. border-top-right-radius
  26. box-shadow
  27. box-sizing
  28. brightness filter
  29. calc
  30. column-count
  31. column-gap
  32. column-rule
  33. column-width
  34. columns
  35. contrast filter
  36. display flexbox
  37. drop-shadow filter
  38. filter
  39. flex flexbox
  40. flex-basis flexbox
  41. flex-direction flexbox
  42. flex-grow flexbox
  43. flex-shrink flexbox
  44. flex-wrap flexbox
  45. font-face
  46. grayscale filter
  47. hue-rotate filter
  48. hyphens
  49. invert filter
  50. justify-content flexbox
  51. keyframes
  52. opacity
  53. order
  54. perspective
  55. perspective-origin
  56. placeholder
  57. rotate transform
  58. rotate3d transform
  59. rotateX transform
  60. rotateY transform
  61. rotateZ transform
  62. saturate filter
  63. scale transform
  64. scale3d transform
  65. scaleX transform
  66. scaleY transform
  67. scaleZ transform
  68. selection
  69. sepia filter
  70. size width, height
  71. skew transform
  72. skewX transform
  73. skewY transform
  74. transform
  75. transform-origin
  76. transform-style
  77. transition
  78. transition-delay
  79. transition-duration
  80. transition-property
  81. transition-timing-function
  82. translate transform
  83. translate3d transform
  84. translateX transform
  85. translateY transform
  86. translateZ transform
  87. user-select

• align-content

Summary:

The CSS align-content property aligns a flex container's lines within the flex container when there is an extra space on the cross-axis. This property has no effect on the single line flexible boxes.

Resources: MDN, CSS-Tricks

Syntax:

Default value: stretch

.align-content(flex-start | flex-end | center | space-between | space-around | stretch)

Example:

div {
 .align-content(flex-start);
}

// Result
div {
 -webkit-align-content: flex-start;
 -ms-flex-line-pack: start;
 align-content: flex-start;
} 

• align-items

Summary:

The CSS align-items property aligns flex items of the current flex line the same way as justify-content but in the perpendicular direction.

Resources: MDN, CSS-Tricks

Syntax:

Default value: stretch

.align-items(flex-start | flex-end | center | baseline | stretch)

Example:

div {
 .align-items(flex-start);
}

// Result
div {
 -webkit-box-align: flex-start;
 -moz-box-align: start;
 -webkit-align-items: start;
 -ms-flex-align: flex-start;
 align-items: flex-start;
}

• align-self

Summary:

The align-self CSS property aligns flex items of the current flex line overriding the align-items value. If any of the flex item's cross-axis margin is set to auto, then align-self is ignored.

Resources: MDN, CSS-Tricks

Syntax:

Default value: auto

.align-self(auto | flex-start | flex-end | center | baseline | stretch)

Example:

div {
 .align-self(flex-start);
}

// Result
div {
 -webkit-align-self: flex-start;
 -ms-flex-item-align: start;
 align-self: flex-start;
}

• animation

Summary:

Shorthand to define a CSS animation, setting all parameters at once.

Resources: WebPlatform, CSS3files

Syntax:

Default value: none

.animation(animation-name | animation-duration | animation-timing-function | animation-delay | animation-iteration-count | animation-direction | animation-fill-mode , […]*)

Example:

div {
 .animation(nameAnimation 2s linear alternate);
}

// Result
div {
 -webkit-animation: nameAnimation 2s linear alternate;
 -moz-animation: nameAnimation 2s linear alternate;
 -o-animation: nameAnimation 2s linear alternate;
 animation: nameAnimation 2s linear alternate;
}

• animation-delay

Summary:

Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.animation-delay(<time>, …)

Tips and tricks:

If you omit units after time argument, animation-delay is trying to be smart and add properly value.

if (time > 10) {
    time += 'ms';
  } else {
    time += 's';
  }

Example:

div {
 .animation-delay(2, 200);
}

// Result
div {
 -webkit-animation-delay: 2s, 200ms;
 -moz-animation-delay: 2s, 200ms;
 -o-animation-delay: 2s, 200ms;
 animation-delay: 2s, 200ms;
}

• animation-direction

Summary:

The animation-direction CSS property indicates whether the animation should play in reverse on alternate cycles.

Resources: WebPlatform, MDN

Syntax:

Default value: normal

.animation-direction(<single-animation-direction>, …)

Example:

div {
 .animation-direction(reverse, alternate);
}

// Result
div {
 -webkit-animation-direction: reverse, alternate;
 -moz-animation-direction: reverse, alternate;
 -o-animation-direction: reverse, alternate;
 animation-direction: reverse, alternate;
}

• animation-duration

Summary:

The animation-duration CSS property specifies the length of time that an animation should take to complete one cycle.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.animation-duration(<time>, …)

Tips and tricks:

If you omit units after time argument, animation-duration is trying to be smart and add proper value.

if (time > 10) {
    time += 'ms';
  } else {
    time += 's';
  }

Example:

div {
 .animation-duration(2000);
}

// Result
div {
 -webkit-animation-duration: 2000ms;
 -moz-animation-duration: 2000ms;
 -o-animation-duration: 2000ms;
 animation-duration: 2000ms;
}

• animation-fill-mode

Summary:

The animation-fill-mode CSS property specifies how a CSS animation should apply styles to its target before and after it is executing.

Resources: WebPlatform, MDN

Syntax:

Default value: none

.animation-fill-mode(<single-animation-fill-mode>, …)

Example:

div {
 .animation-fill-mode(forwards);
}

// Result
div {
 -webkit-animation-fill-mode: forwards;
 -moz-animation-fill-mode: forwards;
 -o-animation-fill-mode: forwards;
 animation-fill-mode: forwards;
}

• animation-iteration-count

Summary:

The animation-iteration-count CSS property specifies how a CSS animation should apply styles to its target before and after it is executing.

Resources: WebPlatform, MDN

Syntax:

Default value: 1

.animation-iteration-count(<single-animation-iteration-count>, …)

Example:

div {
 .animation-iteration-count(3);
}

// Result
div {
 -webkit-animation-iteration-count: 3;
 -moz-animation-iteration-count: 3;
 -o-animation-iteration-count: 3;
 animation-iteration-count: 3;
} 

• animation-name

Summary:

The animation-name CSS property specifies a list of animations that should be applied to the selected element. Each name indicates a @keyframes at-rule that defines the property values for the animation sequence.

Resources: WebPlatform, MDN

Syntax:

Default value: none

.animation-name(<single-animation-name>, …)

Example:

div {
 .animation-name(animation-1, animation-2);
}

// Result
div {
 -webkit-animation-name: animation-1, animation-2;
 -moz-animation-name: animation-1, animation-2;
 -o-animation-name: animation-1, animation-2;
 animation-name: animation-1, animation-2;
} 

• animation-play-state

Summary:

The animation-play-state CSS property determines whether an animation is running or paused. You can query this property's value to determine whether or not the animation is currently running; in addition, you can set its value to pause and resume playback of an animation.

Resources: WebPlatform, MDN

Syntax:

Default value: running

.animation-play-state(<single-animation-play-state>, …)

Example:

div {
 .animation-play-state(paused);
}

// Result
div {
 -webkit-animation-play-state: paused;
 -moz-animation-play-state: paused;
 -o-animation-play-state: paused;
 animation-play-state: paused;
} 

• animation-timing-function

Summary:

The animation-timing-function CSS property determines whether an animation is running or paused. You can query this property's value to determine whether or not the animation is currently running; in addition, you can set its value to pause and resume playback of an animation.

Resources: WebPlatform, MDN

Syntax:

Default value: ease

.animation-timing-function(<single-animation-timing-function>, …)

Example:

div {
 .animation-timing-function(cubic-bezier(0.1, 0.7, 1.0, 0.1));
}

// Result
div {
 -webkit-animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
 -moz-animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
 -o-animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
 animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
} 

• appearance

Summary:

Allows changing the style of any element to platform-based interface elements or vice versa.

Resources: WebPlatform, CSS-Tricks

Syntax:

Default value: none

.appearance(<appearance>)

Example:

div {
 .appearance();
}

// Result
div {
 -webkit-appearance: none;
 -moz-appearance: none;
 appearance: none;
} 

• backface-visibility

Summary:

The CSS backface-visibility property determines whether or not the back face of the element is visible when facing the user. The back face of an element always is a transparent background, letting, when visible, a mirror image of the front face be displayed.

Resources: WebPlatform, MDN

Syntax:

Default value: none

.backface-visibility(visible | hidden )

Example:

div {
 .backface-visibility(hidden);
}

// Result
div {
 -webkit-backface-visibility: none;
 -moz-backface-visibility: none;
 -ms-backface-visibility: none;
 -o-backface-visibility: none;
 backface-visibility: none;
} 

• background-clip

Summary:

The background-clip CSS property specifies whether an element's background, either the color or image, extends underneath its border.

Resources: WebPlatform, MDN

Syntax:

Default value: border-box

.background-clip(<box>)

Example:

div {
 .background-clip(padding-box);
}

// Result
div {
 -webkit-background-clip: padding-box;
 -moz-background-clip: padding-box;
 background-clip: padding-box;
} 

• background-image

Summary:

With the background-image you can create prefixed linear or radial gradients. The CSS (linear|radial)-gradient() function creates an <image> which represents a linear|radial gradient of colors. The result of this function is an object of the CSS <gradient> data type. Like any other gradient, a CSS linear gradient is not a CSS <color> but an image with no intrinsic dimensions; that is, it has neither natural or preferred size, nor ratio. Its concrete size will match the one of the element it applies to.

Resources: WebPlatform, MDN

Syntax:

Default value: none

.background-image(<gradient>, ...)

Tips and tricks:

The background-image mixin is the most robust mixin of all.
It generates SVG for Internet Explorer 9, old webkit, moz and opera syntax.
Always use W3C syntax for the mixin. It can recalculate angle for older syntax, transform to top to bottom syntax and it can omit SVG syntax if it's impossible to express SVG e.g. when you call mixin with 55deg.
If you call mixin without arguments, LESS Hat does not generate anything.
Great online gradient generator.

Example:

div {
 .background-image(linear-gradient(to bottom, #fb83fa 0%,#e93cec 100%));
}

// Result
div {
 background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9Imxlc3NoYXQtZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNmYjgzZmEiIHN0b3Atb3BhY2l0eT0iMSIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U5M2NlYyIgc3RvcC1vcGFjaXR5PSIxIi8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2xlc3NoYXQtZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);
 background-image: -webkit-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
 background-image: -moz-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
 background-image: -o-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
 background-image: linear-gradient(to bottom, #fb83fa 0%, #e93cec 100%);
}

• background-origin

Summary:

The background-origin CSS property determines the background positioning area, that is the position of the origin of an image specified using the background-image CSS property.

Resources: WebPlatform, MDN

Syntax:

Default value: padding-box

.background-origin(<box>)

Example:

  div {
   .background-origin(content-box);
  }
  
  // Result
  div {
   -webkit-background-origin: content-box;
   -moz-background-origin: content-box;
   background-origin: content-box;
  } 

• background-size

Summary:

The background-size CSS property specifies the size of the background images. The size of the image can be fully constrained or only partially in order to preserve its intrinsic ratio.

Resources: WebPlatform, MDN

Syntax:

Default value: auto auto

.background-size(<bg-size>, ...)

Tips and tricks:

If you omit units, background-size adds px automatically.

Example:

div {
 .background-size(cover, 100%);
}

// Result
div {
 -webkit-background-size: cover, 100%;
 -moz-background-size: cover, 100%;
 background-size: cover, 100%;
} 

• blur (shorthand for filter property)

Summary:

Applies a Gaussian blur to the input image. The value of ‘radius’ defines the value of the standard deviation to the Gaussian function, or how many pixels on the screen blend into each other, so a larger value will create more blur. If no parameter is provided, then a value 0 is used. The parameter is specified as a CSS length, but does not accept percentage values.

Resources: MDN

Syntax:

Default value: 0

.blur(length)

Tips and tricks:

If you omit units, blur adds px automatically.

Example:

div {
 .blur(5px);
}

// Result
div {
 -webkit-filter: blur(5px);
 -moz-filter: blur(5px);
 -ms-filter: blur(5px);
 filter: blur(5px);
} 

• border-bottom-left-radius

Summary:

The border-bottom-left-radius CSS property sets the rounding of the bottom-left corner of the element. The rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.border-bottom-left-radius(length | percentage)

Tips and tricks:

If you omit units, border-bottom-left-radius adds px automatically. If you want to use syntax like 10px \ 5px, you have to interpolate argument ~'' or LESS CSS divides it (yeah awesome feature!). Also LESS Hat adds background-clip: padding-box, because it fixes problem with older Safari. Here is some resource.

Example:

div {
 .border-bottom-left-radius(10px);
}

// Result
div {
 -webkit-border-bottom-left-radius: 10px;
 -moz-border-radius-bottomleft: 10px;
 border-bottom-left-radius: 10px;
}   

• border-bottom-right-radius

Summary:

The border-bottom-right-radius CSS property sets the rounding of the bottom-left corner of the element. The rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.border-bottom-right-radius(length | percentage)

Tips and tricks:

If you omit units, border-bottom-right-radius adds px automatically. If you want to use syntax like 10px \ 5px, you have to interpolate argument ~'' or LESS CSS divides it (yeah awesome feature!). Also LESS Hat adds background-clip: padding-box, because it fixes problem with older Safari. Here is some resource.

Example:

  div {
   .border-bottom-right-radius(10px);
  }
  
  // Result
  div {
   -webkit-border-bottom-right-radius: 10px;
   -moz-border-radius-bottomright: 10px;
   border-bottom-right-radius: 10px;
  }   

• border-image

Summary:

The border-image CSS property allows drawing an image on the borders of elements. This makes drawing complex looking widgets much simpler than it has been and removes the need for nine boxes in some cases.

Resources: WebPlatform, MDN

Syntax:

Default value: based on individual properties

.border-image(border-image-source border-image-slice border-image-width border-image-outset border-image-repeat)

Tips and tricks:

If you call mixin without arguments, LESS Hat does not generate anything. Good border-image online generator.

Example:

div {
 .border-image(url(border.png) 61 45 62 54 repeat);
}

// Result
div {
 -webkit-border-image: url(border.png) 61 45 62 54 repeat;
 -moz-border-image: url(border.png) 61 45 62 54 repeat;
 -o-border-image: url(border.png) 61 45 62 54 repeat;
 border-image: url(border.png) 61 45 62 54 repeat;
} 

• border-radius

Summary:

The border-radius CSS property allows Web authors to define how rounded border corners are. The curve of each corner is defined using one or two radii, defining its shape: circle or ellipse.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.border-radius(length | percentage | length / length | percentage / percentage)

Tips and tricks:

If you omit units, border-radius adds px automatically. If you want to use syntax like 10px \ 5px, you have to interpolate argument ~'' or LESS CSS divides it (yeah awesome feature!). Also LESS Hat adds background-clip: padding-box, because it fixes problem with older Safari. Here is some resource.

Example:

div {
 .border-radius(5px);
}

// Result
div {
 -webkit-border-radius: 5px;
 -moz-border-radius: 5px;
 border-radius: 5px;
} 

• border-top-left-radius

Summary:

The border-top-left-radius CSS property sets the rounding of the top-left corner of the element. The rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.border-top-left-radius(length | percentage)

Tips and tricks:

If you omit units, border-top-left-radius adds px automatically. If you want to use syntax like 10px \ 5px, you have to interpolate argument ~'' or LESS CSS divides it (yeah awesome feature!). Also LESS Hat adds background-clip: padding-box, because it fixes problem with older Safari. Here is some resource.

Example:

div {
 .border-top-left-radius(5px);
}

// Result
div {
 -webkit-border-top-left-radius: 5px;
 -moz-border-top-left-radius: 5px;
 border-top-left-radius: 5px;
} 

• border-top-right-radius

Summary:

The border-top-right-radius CSS property sets the rounding of the top-right corner of the element. The rounding can be a circle or an ellipse, or if one of the value is 0 no rounding is done and the corner is square.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.border-top-right-radius(length | percentage)

Tips and tricks:

If you omit units, border-top-right-radius adds px automatically. If you want to use syntax like 10px \ 5px, you have to interpolate argument ~'' or LESS CSS divides it (yeah awesome feature!). Also LESS Hat adds background-clip: padding-box, because it fixes problem with older Safari. Here is some resource.

Example:

div {
 .border-top-right-radius(5px);
}

// Result
div {
 -webkit-border-top-right-radius: 5px;
 -moz-border-top-right-radius: 5px;
 border-top-right-radius: 5px;
} 

• box-shadow

Summary:

The box-shadow CSS property describes one or more shadow effects as a comma-separated list. It allows casting a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).

Resources: WebPlatform, MDN

Syntax:

Default value: none

.box-shadow(<offset-x> <offset-y> spread blur-radius color inset, …)

Tips and tricks:

If you omit units, box-shadow adds px automatically.

Example:

div {
 .box-shadow(0 1px 10px rgba(20,20,20,0.5));
}

// Result
div {
 -webkit-box-shadow: 0 1px 10px rgba(20,20,20,0.5);
 -moz-box-shadow: 0 1px 10px rgba(20,20,20,0.5);
 box-shadow: 0 1px 10px rgba(20,20,20,0.5);
} 

• box-sizing

Summary:

The box-sizing CSS property is used to alter the default CSS box model used to calculate widths and heights of elements. It is possible to use this property to emulate the behavior of browsers that do not correctly support the CSS box model specification.

Resources: WebPlatform, MDN

Syntax:

Default value: content-box

.box-sizing(content-box | padding-box | border-box)

Example:

div {
 .box-sizing(padding-box);
}

// Result
div {
 -webkit-box-sizing: padding-box;
 -moz-box-sizing: padding-box;
 box-sizing: padding-box;
}

• brightness (shorthand for filter property)

Summary:

Applies a linear multiplier to input image, making it appear more or less bright. A value of 0% will create an image that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of an amount over 100% are allowed, providing brighter results. If the ‘amount’ parameter is missing, a value of 100% is used.

Resources: MDN

Syntax:

Default value: 0

.brightness(amount)

Example:

div {
 .brightness(0.5);
}

// Result
div {
 -webkit-filter: brightness(0.5);
 -moz-filter: brightness(0.5);
 -ms-filter: brightness(0.5);
 filter: brightness(0.5);
} 

• calc

Summary:

The calc() CSS function can be used anywhere a <length>, <frequency>, <angle>, <time>, <number>, or <integer> is required.With calc(), you can perform calculations to determine CSS property values.

THIS MIXIN MUST BE INTERPOLATED ~''
The -lh-property: 0 junk line of code is a neccesary sacrifice due to the hack nature of this set of mixins. (via less-properties)

Resources: MDN

Syntax:

.calc(<element>, ~'<expression>')

Example:

div {
 .calc(width, ~'100% - 33px');
}

// Result
div {
 -lh-property: 0;
 width:-webkit-calc(100% - 33px);
 width:-moz-calc(100% - 33px);
 width:calc(100% - 33px);
} 

• column-count

Summary:

The column-count CSS property describes the number of columns of the element.

Resources: WebPlatform, MDN

Syntax:

Default value: auto

.column-count(<number> | auto)

Example:

div {
 .column-count(3);
}

// Result
div {
 -webkit-column-count: 0.5;
 -moz-column-count: 0.5;
 column-count: 0.5;
}   

• column-gap

Summary:

The column-gap CSS property sets the size of the gap between columns for elements which are specified to display as a multi-column element.

Resources: WebPlatform, MDN

Syntax:

Default value: normal

.column-gap(<length> | normal)

Tips and tricks:

If you omit units, column-gap adds px automatically.

Example:

div {
 .column-gap(30);
}

// Result
div {
 -webkit-column-gap: 30px;
 -moz-column-gap: 30px;
 column-gap: 30px;
}   

• column-rule

Summary:

In multi-column layouts, the column-rule CSS property specifies a straight line, or "rule", to be drawn between each column.

Resources: WebPlatform, MDN

Syntax:

Default value: medium none black

.column-rule(<column-rule-width> | <column-rule-style> | <column-rule-color>)

Tips and tricks:

If you omit units, column-rule adds px automatically.

Example:

div {
 .column-rule(5 outset #ff00ff);
}

// Result
div {
 -webkit-column-rule: 5px outset #ff00ff;
 -moz-column-rule: 5px outset #ff00ff;
 column-rule: 5px outset #ff00ff;
} 

• column-width

Summary:

The column-width CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the column around that suggested value, allowing to achieve scalable designs that fit different screen size.

Resources: WebPlatform, MDN

Syntax:

Default value: auto

.column-width(<length> | auto)

Tips and tricks:

If you omit units, column-width adds px automatically.

Example:

div {
 .column-width(100px);
}

// Result
div {
 -webkit-column-width: 100px;
 -moz-column-width: 100px;
 column-width: 100px;
}  

• columns

Summary:

The columns CSS property is a shorthand property allowing to set both the column-width and the column-count properties at the same time.

Resources: WebPlatform, MDN

Syntax:

Default value: auto

.columns(<column-width> | <column-count>)

Tips and tricks:

If you omit units for column-width argument, columns adds px to it automatically.

Example:

div {
 .columns(100 3);
}

// Result
div {
 -webkit-columns: 100px 3;
 -moz-columns: 100px 3;
 columns: 100px 3;
} 

• contrast

Summary:

Adjusts the contrast of the input. A value of 0% will create an image that is completely black. A value of 100% leaves the input unchanged. Values of amount over 100% are allowed, providing results with less contrast. If the ‘amount’ parameter is missing, a value of 100% is used.

Resources: MDN

Syntax:

Default value: 100%

.contrast(<amount>)

Tips and tricks:

If you omit units, contrast adds % automatically.

Example:

div {
 .contrast(200);
}

// Result
div {
 -webkit-filter: contrast(200%);
 -moz-filter: contrast(200%);
 -ms-filter: contrast(200%);
 filter: contrast(200%);
} 

• display

Summary:

The display CSS property specifies the type of rendering box used for an element. This mixin is specifically for flexbox purpose.

Resources: CSS-Tricks

Syntax:

.display(<flex> | <inline-flex>)

Example:

div {
 .display(flex);
}

// Result
div {
 display: -webkit-box;
 display: -ms-flexbox;
 display: -webkit-flex;
 display: -moz-box;
} 

• drop-shadow

Summary:

Applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input image's alpha mask drawn in a particular color, composited below the image.

Resources: MDN

Syntax:

.drop-shadow(<offset-x> <offset-y> [<blur-radius> | <spread-radius> | <color>])

Tips and tricks:

If you omit units, drop-shadow adds px automatically.

Example:

div {
 .drop-shadow(16 16 10 black);
}

// Result
div {
 -webkit-filter: drop-shadow(16px 16px 10px #000000);
 -moz-filter: drop-shadow(16px 16px 10px #000000);
 -ms-filter: drop-shadow(16px 16px 10px #000000);
 filter: drop-shadow(16px 16px 10px #000000);
} 

• filter

Summary:

The CSS filter property provides for effects like blurring or color shifting on an element’s rendering before the element is displayed. Filters are commonly used to adjust the rendering of an image, a background, or a border.

Resources: MDN

Syntax:

Default value: none

.filter(<filter-function>*)

Example:

div {
 .filter(grayscale(0.5) blur(10px));
}

// Result
div {
 -webkit-filter: grayscale(0.5) blur(10px);
 -moz-filter: grayscale(0.5) blur(10px);
 -ms-filter: grayscale(0.5) blur(10px);
 filter: grayscale(0.5) blur(10px);
}

• flex

Summary:

The flex CSS property specifies ability of a flex item to alter their dimensions to fill the available space. Flex items can be stretched to use available space proportional to their flex grow factor or their flex shrink factor to prevent overflow.

Resources: MDN, CSS-Tricks

Syntax:

Default value: 0 1 auto

.flex(none | [ <flex-grow> <flex-shrink> | <flex-basis> ])

Example:

div {
 .flex(1 3 100px);
}

// Result
div {
 -webkit-box-flex: 1;
 -moz-box-flex: 1;
 -webkit-flex: 1 3 100px;
 -ms-flex: 1 3 100px;
 flex: 1 3 100px;
}

• flex-basis

Summary:

The CSS flex-basis property specifies the flex basis which is the initial main size of a flex item.

Resources: MDN, CSS-Tricks

Syntax:

Default value: auto

.flex-basis(<width>)

Tips and tricks:

If you omit units, flex-basis adds px automatically.

Example:

div {
 .flex-basis(100);
}

// Result
div {
 -webkit-flex-basis: 100;
 flex-basis: 100px;
}

• flex-direction

Summary:

The CSS flex-direction property specifies how flex items are placed in the flex container defining the main axis and the direction (normal or reversed).

Resources: MDN, CSS-Tricks

Syntax:

Default value: row

.flex-direction(row | row-reverse | column | column-reverse) 

Example:

div {
 .flex-direction(row);
}

// Result
div {
 -webkit-box-direction: normal;
 -moz-box-direction: normal;
 -webkit-box-orient: horizontal;
 -moz-box-orient: horizontal;
 -webkit-flex-direction: row;
 -ms-flex-direction: row;
 flex-direction: row;
}

• flex-grow

Summary:

The CSS flex-grow property specifies the flex grow factor of a flex item.

Resources: MDN, CSS-Tricks

Syntax:

Default value: 0

.flex-grow(<number>) 

Example:

div {
 .flex-grow(2);
}

// Result
div {
 -webkit-flex-grow: 2;
 flex-grow: 2;
}

• flex-shrink

Summary:

The CSS flex-shrink property specifies the flex shrink factor of a flex item.

Resources: MDN, CSS-Tricks

Syntax:

Default value: 1

.flex-shrink(<number>) 

Example:

div {
 .flex-shrink(2);
}

// Result
div {
 -webkit-flex-shrink: 2;
 flex-shrink: 2;
}

• flex-wrap

Summary:

The CSS flex-wrap property specifies whether the children are forced into a single line or if the items can be flowed on multiple lines.

Resources: MDN, CSS-Tricks

Syntax:

Default value: nowrap

.flex-wrap(nowrap | wrap | wrap-reverse) 

Example:

div {
 .flex-wrap(wrap-reverse);
}

// Result
div {
 -webkit-flex-wrap: 2;
 -ms-flex-wrap: 2;
 flex-wrap: 2;
}

• font-face

Summary:

The @font-face CSS at-rule allows authors to specify online fonts to display text on their web pages.

Resources: MDN

Syntax:

.font-face(@fontname, @fontfile, @fontweight:normal, @fontstyle:normal) 

Example:

div {
 .font-face(Hipster, ~'../fonts/hipster', bold, italic);
}

// Result
div {
 font-family: "Hipster";
 src: url("../fonts/hipster.eot");
 src: url("../fonts/hipster.eot?#iefix") format("embedded-opentype"), url("../fonts/hipster.woff") format("woff"), url("../fonts/hipster.ttf") format("truetype"), url("../fonts/hipster.svg#Hipster") format("svg");
 font-weight: bold;
 font-style: italic;
}

• grayscale

Summary:

Converts the input image to grayscale. The value of ‘amount’ defines the proportion of the conversion. A value of 100% is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. If the ‘amount’ parameter is missing, a value of 100% is used.

Resources: MDN

Syntax:

Default value: 0

.grayscale(<percentage>) 

Tips and tricks:

If you omit units, grayscale adds % automatically.

Example:

div {
 .grayscale(50);
}

// Result
div {
 -webkit-filter: grayscale(50%);
 -moz-filter: grayscale(50%);
 -ms-filter: grayscale(50%);
 filter: grayscale(50%);
}

• hue-rotate

Summary:

Applies a hue rotation on the input image. The value of ‘angle’ defines the number of degrees around the color circle the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the ‘angle’ parameter is missing, a value of 0deg is used. Maximum value is 360deg.

Resources: MDN

Syntax:

Default value: 0

.hue-rotate(<percentage>) 

Tips and tricks:

If you omit units, hue-rotate adds deg automatically.

Example:

div {
 .hue-rotate(50);
}

// Result
div {
 -webkit-filter: hue-rotate(50deg);
 -moz-filter: hue-rotate(50deg);
 -ms-filter: hue-rotate(50deg);
 filter: hue-rotate(50deg);
}

• hyphens

Summary:

The hyphens CSS property tells the browser how to go about splitting words to improve the layout of text when line-wrapping.

Resources: MDN

Syntax:

Default value: manual

.hyphens(none | manual | auto)

Example:

div {
 .hyphens(none);
}

// Result
div {
 -webkit-hyphens: none;
 -moz-hyphens: none;
 -ms-hyphens: none;
} 

• invert

Summary:

Inverts the samples in the input image. The value of ‘amount’ defines the proportion of the conversion. A value of 100% is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. If the ‘amount’ parameter is missing, a value of 100% is used.

Resources: MDN

Syntax:

Default value: 0

.invert(<percentage>) 

Tips and tricks:

If you omit units, invert adds % automatically.

Example:

div {
 .invert(100);
}

// Result
div {
 -webkit-filter: invert(100%);
 -moz-filter: invert(100%);
 -ms-filter: invert(100%);
 filter: invert(100%);
}

• justify-content

Summary:

The CSS justify-content property defines how a browser distributes available space between and around elements when aligning flex items in the main-axis of the current line.

Resources: MDN, CSS-Tricks

Syntax:

Default value: flex-start

.justify-content(flex-start | flex-end | center | space-between | space-around) 

Example:

div {
 .justify-content(flex-start);
}

// Result
div {
 -webkit-box-pack: flex-start;
 -moz-box-pack: start;
 -webkit-justify-content: start;
 -ms-flex-pack: flex-start;
 justify-content: flex-start;
}

• keyframes

Summary:

The @keyframes CSS at-rule lets authors control the intermediate steps in a CSS animation sequence by establishing keyframes (or waypoints) along the animation sequence that must be reached by certain points during the animation.

LESS CSS isn't great for complicated mixin like this one, so it's little bit tricky. LESS CSS compiler doesn't allow to have properties in the root. It's better to understand the problem on the example.

// There is no selector
color: red;

SyntaxError: properties must be inside selector blocks, they cannot be in the root. 

div { color: red; } // This is correct

Therefore LESS Hat generates placeholder selector lesshat-selector { -lh-property: 0; } with unknown property, which browsers ignore and after that, there is actually keyframes syntax.

And also because of bad architecture of LESS CSS language, keyframes definition has to be on single line.

THIS MIXIN MUST BE INTERPOLATED ~''

Resources: WebPlatform, MDN

Syntax:

.keyframes(~'<keyframes-name>, <keyframes-definition>') 

Tips and tricks:

Properties inside <keyframes-definition> are automatically prefixed, if it's needed.
Keyframes mixin supports prefix configuration but it's computationally demanding so it is commented out and all prefixes are rendered. Feel free to uncommented that if you need it.

Example:

.keyframes(~'animationName, 0%{ transform: scale(1.5); color: blue; } 100%{ transform: scale(2); color: red }');

// Result
 lesshat-selector {-lh-property: 0; } 
 @-webkit-keyframes animationName{ 0%{ -webkit-transform: scale(1.5); color: blue; } 100%{ -webkit-transform: scale(2); color: red }}
 @-moz-keyframes animationName{ 0%{ -moz-transform: scale(1.5); color: blue; } 100%{ -moz-transform: scale(2); color: red }}
 @-o-keyframes animationName{ 0%{ -o-transform: scale(1.5); color: blue; } 100%{ -o-transform: scale(2); color: red }}
 @keyframes animationName{ 0%{ transform: scale(1.5); color: blue; } 100%{ transform: scale(2); color: red };} 

• opacity

Summary:

The opacity CSS property specifies the transparency of an element, that is, the degree to which the background behind the element is overlaid.

This is not shorthand method for filter opacity.

Resources: MDN

Syntax:

Default value: 1

.opacity(<number>) 

Tips and tricks:

You can enable old filter syntax for IE6, just set @ms_local: true.

Example:

div {
 .opacity(.5);
}

// Result
div {
 -webkit-opacity: 0.5;
 -moz-opacity: 0.5;
 opacity: 0.5;
}

• order

Summary:

The CSS order property specifies the order used to lay out flex items in their flex container.

Resources: MDN, CSS-Tricks

Syntax:

Default value: 0

.order(<integer>) 

Example:

div {
 .order(1);
}

// Result
div {
 -webkit-box-ordinal-group: 1;
 -moz-box-ordinal-group: 1;
 -ms-flex-order: 1;
 -webkit-order: 1;
 order: 1;
}

• perspective

Summary:

The perspective CSS property determines the distance between the z=0 plane and the user in order to give to the 3D-positioned element some perspective.

Resources: MDN, CSS-Tricks

Syntax:

Default value: none

.perspective(none | <length>)

Tips and tricks:

If you omit units, perspective adds px automatically.

Example:

div {
 .perspective(1000);
}

// Result
div {
 -moz-perspective: 1000px;
 -webkit-perspective: 1000px;
 perspective: 1000px;
}

• perspective-origin

Summary:

The perspective-origin CSS property determines the position the viewer is looking at. It is used as the vanishing point by the perspective property.

Resources: MDN, CSS-Tricks

Syntax:

Default value: 50% 50%

.perspective-origin(<percentage> | <length> | constants | inherit)

Tips and tricks:

If you omit units, perspective-origin adds % automatically.

Example:

div {
 .perspective-origin(top left);
}

// Result
div {
 -moz-perspective-origin: top left;
 -webkit-perspective-origin: top left;
 perspective-origin: top left;
}

• placeholder

Summary:

Placeholder is the short hint displayed in the input field before the user clicked to it. Default placeholder text in inputs has a light gray color (so far).

Resources: CSS-Tricks

Syntax:

.placeholder(<color>, [<element>])

Example:

div {
 .placeholder(#666666);
}

// Result
div::-webkit-input-placeholder {
   color: #666666;
}
div:-moz-placeholder {
   color: #666666;
}
div::-moz-placeholder {
   color: #666666;
}
div:-ms-input-placeholder {
   color: #666666;
}

// In root (outside of selectors)
.placeholder(#333333);

// Result
::-webkit-input-placeholder {
   color: #666666;
}
:-moz-placeholder {
   color: #666666;
}
::-moz-placeholder {
   color: #666666;
}
:-ms-input-placeholder {
   color: #666666;
}

// In root (outside of selectors)
.placeholder(#333333, textarea);

// Result
textarea::-webkit-input-placeholder {
   color: #666666;
}
textarea:-moz-placeholder {
   color: #666666;
}
textarea::-moz-placeholder {
   color: #666666;
}
textarea:-ms-input-placeholder {
   color: #666666;
}

• rotate

Summary:

Rotates the element clockwise around its origin by the specified angle.

Resources: MDN

Syntax:

Default value: 0

.rotate(<angle>)

Tips and tricks:

If you omit units, rotate adds deg automatically.

Example:

div {
 .rotate(45);
}

// Result
div {
 -webkit-transform: rotate(45deg);
 -moz-transform: rotate(45deg);
 -ms-transform: rotate(45deg);
 -o-transform: rotate(45deg);
 transform: rotate(45deg);
}

• rotate3d

Summary:

The rotate3d()CSS function defines a transformation that moves the element around a fixed axe without deforming it.

Resources: MDN

Syntax:

Default value: 0, 0, 0, 0

.rotate3d(<number>, <number>, <number>, <angle>)

Tips and tricks:

If you omit angle unit, rotate3d adds deg automatically.

Example:

div {
 .rotate3d(1, 0, 0, 50);
}

// Result
div {
 -webkit-transform: rotate3d(1, 0, 0, 50deg);
 -moz-transform: rotate3d(1, 0, 0, 50deg);
 -ms-transform: rotate3d(1, 0, 0, 50deg);
 -o-transform: rotate3d(1, 0, 0, 50deg);
 transform: rotate3d(1, 0, 0, 50deg);
}

• rotateX

Summary:

The rotateX() CSS function defines a transformation that moves the element around the abscissa without deforming it.

Resources: MDN

Syntax:

Default value: 0

.rotateX(<angle>)

Tips and tricks:

If you omit units, rotateX adds deg automatically.

Example:

div {
 .rotateX(45);
}

// Result
div {
 -webkit-transform: rotateX(45deg);
 -moz-transform: rotateX(45deg);
 -ms-transform: rotateX(45deg);
 -o-transform: rotateX(45deg);
 transform: rotateX(45deg);
}

• rotateY

Summary:

The rotateY() CSS function defines a transformation that moves the element around the ordinate without deforming it.

Resources: MDN

Syntax:

Default value: 0

.rotateY(<angle>)

Tips and tricks:

If you omit units, rotateY adds deg automatically.

Example:

div {
 .rotateY(45);
}

// Result
div {
 -webkit-transform: rotateY(45deg);
 -moz-transform: rotateY(45deg);
 -ms-transform: rotateY(45deg);
 -o-transform: rotateY(45deg);
 transform: rotateY(45deg);
}

• rotateZ

Summary:

The rotateZ() CSS function defines a transformation that moves the element around the z-axis without deforming it.

Resources: MDN

Syntax:

Default value: 0

.rotateZ(<angle>)

Tips and tricks:

If you omit units, rotateZ adds deg automatically.

Example:

div {
 .rotateZ(45);
}

// Result
div {
 -webkit-transform: rotateZ(45deg);
 -moz-transform: rotateZ(45deg);
 -ms-transform: rotateZ(45deg);
 -o-transform: rotateZ(45deg);
 transform: rotateZ(45deg);
}

• saturate

Summary:

Saturates the input image. The value of ‘amount’ defines the proportion of the conversion.

Resources: MDN

Syntax:

Default value: 100%

.saturate(<amount>)

Tips and tricks:

If you omit units, saturate adds % automatically.

Example:

div {
 .saturate(45);
}

// Result
div {
 -webkit-filter: saturate(45deg);
 -moz-filter: saturate(45deg);
 -ms-filter: saturate(45deg);
 filter: saturate(45deg);
}

• scale

Summary:

Specifies a 2D scaling operation described by [sx, sy]. If sy isn't specified, it is assumed to be equal to sx.

Resources: MDN

Syntax:

Default value: 1

.scale(<sx>[, <sy>]) 

Example:

div {
 .scale(2);
}

// Result
div {
 -webkit-transform: scale(2);
 -moz-transform: scale(2);
 -ms-transform: scale(2);
 -o-transform: scale(2);
 transform: scale(2);
}

• scale3d

Summary:

The scale3d() CSS function modifies the size of an element. Because the amount of scaling is defined by a vector, it can resize different dimensions at different scales.

Resources: MDN

Syntax:

Default value: 1, 1, 1

.scale3d(<sx>, <sy>, <sz>) 

Example:

div {
 .scale3d(1.5, .2, 3);
}

// Result
div {
 -webkit-transform: scale3d(1.5, 0.2, 3);
 -moz-transform: scale3d(1.5, 0.2, 3);
 -ms-transform: scale3d(1.5, 0.2, 3);
 -o-transform: scale3d(1.5, 0.2, 3);
 transform: scale3d(1.5, 0.2, 3);
}

• scaleX

Summary:

Specifies a scale operation using the vector [sx, 1].

Resources: MDN

Syntax:

Default value: 1

.scaleX(<sx>) 

Example:

div {
 .scaleX(1.5);
}

// Result
div {
 -webkit-transform: scaleX(1.5);
 -moz-transform: scaleX(1.5);
 -ms-transform: scaleX(1.5);
 -o-transform: scaleX(1.5);
 transform: scaleX(1.5);
}

• scaleY

Summary:

Specifies a scale operation using the vector [1, sy].

Resources: MDN

Syntax:

Default value: 1

.scaleY(<sy>) 

Example:

div {
 .scaleY(1.5);
}

// Result
div {
 -webkit-transform: scaleY(1.5);
 -moz-transform: scaleY(1.5);
 -ms-transform: scaleY(1.5);
 -o-transform: scaleY(1.5);
 transform: scaleY(1.5);
}

• scaleZ

Summary:

The scaleZ() CSS function modifies the z-coordinate of each element point by a constant facto, except if this scale factor is 1, in which case the function is the identity transform.

Resources: MDN

Syntax:

Default value: 1

.scaleZ(<sz>) 

Example:

div {
 .scaleZ(1.5);
}

// Result
div {
 -webkit-transform: scaleZ(1.5);
 -moz-transform: scaleZ(1.5);
 -ms-transform: scaleZ(1.5);
 -o-transform: scaleZ(1.5);
 transform: scaleZ(1.5);
}

• selection

Summary:

The ::selection CSS pseudo-element applies rules to the portion of a document that has been highlighted. LESS CSS compiler doesn't allow to have properties in the root. It's better to understand the problem on the example.

// There is no selector
color: red;

SyntaxError: properties must be inside selector blocks, they cannot be in the root. 

div { color: red; } // This is correct

Therefore LESS Hat generates placeholder selector lesshat-selector { -lh-property: 0; } with unknown property, which browsers ignore and after that, there is actually selection syntax.

THIS MIXIN MUST BE INTERPOLATED ~''

Use this mixin outside of CSS selectors

Resources: MDN

Syntax:

.selection(<CSS properties>[, <element>]) 

Example:

.selection(~'color: blue; background: red');

// Result
lesshat-selector {-lh-property: 0;} 
::selection{color: blue; background: red}
::-moz-selection{color: blue; background: red;}

• sepia

Summary:

Converts the input image to Instagram like effect.

Resources: MDN

Syntax:

.sepia(<percentage>) 

Tips and tricks:

If you omit units, sepia adds % automatically.

Example:

div {
 .sepia(50);
}

// Result
div {
 -webkit-filter: sepia(50%);
 -moz-filter: sepia(50%);
 filter: sepia(50%);
}

• size

Summary:

This is helper mixin for fast dimensions setup.

Syntax:

.size(<width>, [<height>]) 

Tips and tricks:

When you call mixin with only one argument, second will be the same. Also you can omit units and size adds it automatically.

Example:

div {
 .size(50);
}

// Result
div {
 width: 50px;
 height: 50px;
}

• skew

Summary:

Skews the element along the X and Y axes by the specified angles. If ay isn't provided, no skew is performed on the Y axis.

Resources: MDN

Syntax:

Default value: 0

.skew(<ax>[, <ay>]) 

Tips and tricks:

If you omit units, skew adds % automatically.

Example:

div {
 .skew(20, 30);
}

// Result
div {
 -webkit-transform: skew(20deg, 30deg);
 -moz-transform: skew(20deg, 30deg);
 -ms-transform: skew(20deg, 30deg);
 -o-transform: skew(20deg, 30deg);
 transform: skew(20deg, 30deg);
}

• skewX

Summary:

Skews the element along the X axis by the given angle.

Resources: MDN

Syntax:

Default value: 0

.skewX(<angle>) 

Tips and tricks:

If you omit units, skewX adds % automatically.

Example:

div {
 .skewX(20);
}

// Result
div {
 -webkit-transform: skewX(20deg);
 -moz-transform: skewX(20deg);
 -ms-transform: skewX(20deg);
 -o-transform: skewX(20deg);
 transform: skewX(20deg);
}

• skewY

Summary:

Skews the element along the Y axis by the given angle.

Resources: MDN

Syntax:

Default value: 0

.skewY(<angle>) 

Tips and tricks:

If you omit units, skewY adds % automatically.

Example:

div {
 .skewY(20);
}

// Result
div {
 -webkit-transform: skewY(20deg);
 -moz-transform: skewY(20deg);
 -ms-transform: skewY(20deg);
 -o-transform: skewY(20deg);
 transform: skewY(20deg);
}

• transform

Summary:

The CSS transform property lets you modify the coordinate space of the CSS visual formatting model.

Resources: WebPlatform, MDN

Syntax:

Default value: none

.transform(none | <transform-function>+) 

Tips and tricks:

If you omit units, transform can adds correct unit automatically.

 translate: 'px',
 rotate: 'deg',
 rotate3d: 'deg',
 skew: 'deg'

Example:

div {
 .transform(scale(.5) translate(10, 20));
}

// Result
div {
 -webkit-transform: scale(.5) translate(10, 20);
 -moz-transform: scale(.5) translate(10, 20);
 -ms-transform: scale(.5) translate(10, 20);
 -o-transform: scale(.5) translate(10, 20);
 transform: scale(.5) translate(10, 20);
}

• transform-origin

Summary:

The transform-origin CSS property lets you modify the origin for transformations of an element.

Resources: WebPlatform, MDN

Syntax:

Default value: 50% 50% 0

.transform-origin(<percentage> | <length> | <named-position>) 

Tips and tricks:

If you omit units, transform-origin adds % automatically.

Example:

div {
 .transform-origin(50 50);
}

// Result
div {
 -webkit-transform-origin: 50% 50%;
 -moz-transform-origin: 50% 50%;
 -ms-transform-origin: 50% 50%;
 -o-transform-origin: 50% 50%;
 transform-origin: 50% 50%;
}

• transform-style

Summary:

The transform-style CSS property determines if the children of the element are positioned in the 3D-space or are flattened in the plane of the element.

Resources: WebPlatform, MDN

Syntax:

Default value: flat

.transform-style(flat | preserve-3d) 

Example:

div {
 .transform-style(preserve-3d);
}

// Result
div {
 -webkit-transform-style: preserve-3d;
 -moz-transform-style: preserve-3d;
 -ms-transform-style: preserve-3d;
 -o-transform-style: preserve-3d;
 transform-style: preserve-3d;
}

• transition

Summary:

The CSS transition property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay. It allows to define the transition between two states of an element.

Resources: WebPlatform, MDN

Syntax:

Default value: all 0 ease 0

.transition([ none | <single-transition-property> ] | <time> | <timing-function> | <time>)

Tips and tricks:

If you omit units after time argument, transition is trying to be smart and add properly value.

  if (time > 10) {
      time += 'ms';
    } else {
      time += 's';
    }

And also properties inside transition definition are automatically prefixed, if it is needed.
W3C property value is appending all prefixed values.
Why? Some browsers support W3C unprefixed properties, but values must be sometimes prefixed. Let's consider this example:

div {
-webkit-transition: -webkit-filter .3s ease;
-moz-transition: -moz-filter .3s ease;
-o-transition: filter .3s ease;

// There is a problem! Webkit needs -webkit-filter property
transition: filter .3s ease;
}

Example:

div {
 .transition(box-shadow 0.2s linear, color .4s .2s ease);
}

// Result
div {
 -webkit-transition: -webkit-box-shadow 0.2s linear, color 0.4s 0.2s ease;
 -moz-transition: -moz-box-shadow 0.2s linear, color 0.4s 0.2s ease;
 -o-transition: box-shadow 0.2s linear, color 0.4s 0.2s ease;
 transition: box-shadow 0.2s linear, color 0.4s 0.2s ease;
}

• transition-delay

Summary:

The transition-delay CSS property specifies the amount of time to wait between a change being requested to a property that is to be transitioned and the start of the transition effect.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.transition-delay(<time>)

Tips and tricks:

If you omit units after time argument, transition-delay is trying to be smart and add properly value.

  if (time > 10) {
      time += 'ms';
    } else {
      time += 's';
    }

Example:

div {
 .transition-delay(200);
}

// Result
div {
 -webkit-transition-delay: 200ms;
 -moz-transition-delay: 200ms;
 -o-transition-delay: 200ms;
 transition-delay: 200ms;
}

• transition-duration

Summary:

The transition-duration CSS property specifies the number of seconds or milliseconds a transition animation should take to complete. By default, the value is 0s, meaning that no animation will occur.

Resources: WebPlatform, MDN

Syntax:

Default value: 0

.transition-duration(<time>)

Tips and tricks:

If you omit units after time argument, transition-duration is trying to be smart and add properly value.

  if (time > 10) {
      time += 'ms';
    } else {
      time += 's';
    }

Example:

div {
 .transition-duration(6);
}

// Result
div {
 -webkit-transition-duration: 6s;
 -moz-transition-duration: 6s;
 -o-transition-duration: 6s;
 transition-duration: 6s;
}

• transition-property

Summary:

The transition-property CSS property is used to specify the names of CSS properties to which a transition effect should be applied.

Resources: WebPlatform, MDN

Syntax:

Default value: all

.transition-property(<propertyname> | all | none)

Tips and tricks:

And also properties inside transition-property definition are automatically prefixed, if it is needed.
W3C property value is appending all prefixed values.
Why? Some browsers support W3C unprefixed properties, but values must be sometimes prefixed. Let's consider this example:

div {
-webkit-transition: -webkit-filter .3s ease;
-moz-transition: -moz-filter .3s ease;
-o-transition: filter .3s ease;

// There is a problem! Webkit needs -webkit-filter property
transition: filter .3s ease;
}

Example:

div {
 .transition-property(transform);
}

// Result
div {
 -webkit-transition-property: -webkit-transform;
 -moz-transition-property: -moz-transform;
 -o-transition-property: -o-transform;
 transition-property: -webkit-transform,-moz-transform,-o-transform,transform;
}

• transition-timing-function

Summary:

The CSS transition-timing-function property is used to describe how the intermediate values of the CSS properties being affected by a transition effect are calculated. This in essence lets you establish an acceleration curve, so that the speed of the transition can vary over its duration.

Resources: WebPlatform, MDN

Syntax:

Default value: ease

.transition-timing-function(<timing-function>, ...)

Example:

div {
 .transition-timing-function(cubic-bezier(0,0,1,1), ease);
}

// Result
div {
 -webkit-transition-timing-function: cubic-bezier(0, 0, 1, 1), ease;
 -moz-transition-timing-function: cubic-bezier(0, 0, 1, 1), ease;
 -o-transition-timing-function: cubic-bezier(0, 0, 1, 1), ease;
 transition-timing-function: cubic-bezier(0, 0, 1, 1), ease;
}

• translate

Summary:

Specifies a 2D translation by the vector [tx, ty]. If ty isn't specified, its value is assumed to be zero.

Resources: MDN

Syntax:

Default value: 0

.translate(<tx>[, <ty>])

Tips and tricks:

If you omit units, translate adds px automatically.

Example:

div {
 .translate(200);
}

// Result
div {
 -webkit-transform: translate(200px);
 -moz-transform: translate(200px);
 -ms-transform: translate(200px);
 -o-transform: translate(200px);
 transform: translate(200px);
}

• translate3d

Summary:

The translate3d() CSS function moves the position of the element in the 3D space.

Resources: MDN

Syntax:

Default value: 0

.translate3d(<tx>, <ty>, <tz>)

Tips and tricks:

If you omit units, translate3d adds px automatically.

Example:

div {
 .translate3d(20, 30, 10);
}

// Result
div {
 -webkit-transform: translate3d(20px, 30px, 10px);
 -moz-transform: translate3d(20px, 30px, 10px);
 -ms-transform: translate3d(20px, 30px, 10px);
 -o-transform: translate3d(20px, 30px, 10px);
 transform: translate3d(20px, 30px, 10px);
}

• translateX

Summary:

Translates the element by the given amount along the X axis.

Resources: MDN

Syntax:

Default value: 0

.translateX(<tx>)

Tips and tricks:

If you omit units, translateX adds px automatically.

Example:

div {
 .translateX(20);
}

// Result
div {
 -webkit-transform: translateX(20px);
 -moz-transform: translateX(20px);
 -ms-transform: translateX(20px);
 -o-transform: translateX(20px);
 transform: translateX(20px);
}

• translateY

Summary:

Translates the element by the given amount along the Y axis.

Resources: MDN

Syntax:

Default value: 0

.translateY(<ty>)

Tips and tricks:

If you omit units, translateY adds px automatically.

Example:

div {
 .translateY(20);
}

// Result
div {
 -webkit-transform: translateY(20px);
 -moz-transform: translateY(20px);
 -ms-transform: translateY(20px);
 -o-transform: translateY(20px);
 transform: translateY(20px);
}

• translateZ

Summary:

Translates the element by the given amount along the Z axis.

Resources: MDN

Syntax:

Default value: 0

.translateZ(<ty>)

Tips and tricks:

If you omit units, translateZ adds px automatically.

Example:

div {
 .translateZ(20);
}

// Result
div {
 -webkit-transform: translateZ(20px);
 -moz-transform: translateZ(20px);
 -ms-transform: translateZ(20px);
 -o-transform: translateZ(20px);
 transform: translateZ(20px);
}

• user-select

Summary:

Controls the appearance (only) of selection.

Resources: MDN

Syntax:

Default value: auto

.user-select(none | text | all | element)

Example:

div {
 .user-select(none);
}

// Result
div {
 -webkit-user-select: none;
 -moz-user-select: none;
 -ms-user-select: none;
 user-select: none;
}

Big Thanks to:

lesshat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lesshat's Issues

Addition of px unit when using em

Hi guys,

Firstly, I absolutely love LESShat (and CSShat, Enigma64 & SubtlePatterns) so thanks so much for all your work!

I have a use case that might not be common, but if it were possible to find a work around for this it would be great.

I'm using a copy of Lesshat freshly downloaded today - (this didn't occur with the previous version).

For easy conversion of px base sizes to em values I set the following variables:

@base_px: 16;
@toEms: (1 / @base_px) + 0em;

Then wherever I want to set values I do something like:

width: 20 * @toEms;

...which gives me:

width: 1.25em;

I was previously using this process in some box-shadow mixins e.g.:

.box-shadow(0em 2 * @toEms 5 * @toEms 0em rgba(0, 0, 0, 0.5));

Which was giving me:

-webkit-box-shadow: 0em 0.125em 0.3125em 0em rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0em 0.125em 0.3125em 0em rgba(0, 0, 0, 0.5);
box-shadow: 0em 0.125em 0.3125em 0em rgba(0, 0, 0, 0.5);

However now something in my process is being recognized as missing a unit, so I am getting:

-webkit-box-shadow: 0em 0px.125em 0px.3125em 0em rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0em 0px.125em 0px.3125em 0em rgba(0, 0, 0, 0.5);
box-shadow: 0em 0px.125em 0px.3125em 0em rgba(0, 0, 0, 0.5);

I attempted to modify the numWithoutValue variable in the box-shadow mixin so I could contribute something helpful, but unfortunately I haven't much of an idea how to work with RegExp in this regard, sorry about that.

For the moment I just removed the px value from return match+"px" but if there were a way to more correctly deal with this use case that would be great.

Thanks!

Variables passed into .gradient mixin

It would be great to be able to pass LESS global color variables into the .gradient mixin (i.e. .gradient(~"linear-gradient(180deg, @LightGrey 0%, @darkgrey 100%)"); ). Having to declare the hex code for each of these diminishes the value of the variable declaration power of LESS.

Remove male-centric language from hero

There is absolutely no reason for the “A kick-ass LESS mixin library for dudes” headline. You’re alienating users and promoting LESS Hat as a product not meant for women.

.background-size(5px auto) adds a comma

I'm upgrading from 1.1.1 to 2.0.4, and comparing my compiled output.
Everything looks great (bug fixes and what not), but the one issue I've found is the output for .background-size(5px auto) outputs background-size: 5px, auto; (and prefixes are the same).

Invalid webkit property value generated

I'm not sure exactly where the problem is (transition mixin? using a dashed property?), but here is an example that generates an invalid property: -webkit-border-color

.transition(border-color 0.25s);

outputs:

-webkit-transition: -webkit-border-color 0.25s;
-moz-transition: border-color 0.25s;
-o-transition: border-color 0.25s;
transition: border-color 0.25s;

Font smoothing

Feature request !

.font-smoothing( @smoothing: antialiased ) {
    font-smoothing: @smoothing;
    -ms-font-smoothing: @smoothing;
    -moz-font-smoothing: @smoothing;
    -webkit-font-smoothing: @smoothing;
    -o-font-smoothing: @smoothing;
}

This property is still ambiguous... The official spec is font-smooth but is not supported anywhere (https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth). Only Webkit supports its own variation webkit-font-smoothing for now.

So the global support is not huge but this property is very useful. I use it by default on the body with the antialiased value on every project now (instead of default subpixel-antialiased) because the rendering is much better imo.

A mixin would simplify updates for future potential W3C standards changes, don't you think ? I'm not sure about other vendor prefixes though... Also wondering if it would be better to write font-smooth instead of font-smoothing...

Invalid property values

lesshat:

.transition-property(width, left, opacity);

Output:

-webkit-transition-property: width left opacity;
-moz-transition-property: width left opacity;
-o-transition-property: width left opacity;
transition-property: width, left, opacity;

Issue:
Prefixed property values missing commas.


lesshat:

.transition(transform 0.2s);

Output:

-webkit-transition: -webkit-transform 0.2s;
-moz-transition: -moz-transform 0.2s;
-o-transition: -o-transform 0.2s;
transition: -webkit-transform 0.2s,-moz-transform 0.2s,-o-transform 0.2s,transform 0.2s;

Issue:
W3C property value is appending all prefixed values.

.background-image JavaScript

Can you make the unobfuscated JS for the .background-image mixin available? I'd like to add in some additional logic for the older -webkit-gradient syntax, but it would be really helpful to have the unobfuscated base.

Lesshat master does not compile with lessphp 0.3.8

LESSHat master branch does not compile on lessphp 0.3.8, It's working fine in less.js

Edit: I realize now that this is likely a lessphp issue. If someone knows a workaround, feel free to post it.

Here is the stack trace:

 Fatal error: Uncaught exception 'Exception' with message 'parse error: failed at `var arg = "@{arguments}".replace("[","").replace("]","") || "none"; if( !/^\w*([ X])/.test(arg) ) { arg = arg.replace(/,/g,"") } return arg; })()`;` css/lesshat.less on line 105' in /var/www/html/static/lessc.inc.php:3144 Stack trace: #0 /var/www/html/static/lessc.inc.php(2053): lessc_parser->throwError() #1 /var/www/html/static/lessc.inc.php(1575): lessc_parser->parse('// LESS Hat 1....') #2 /var/www/html/static/lessc.inc.php(1611): lessc->compile('// LESS Hat 1....', 'css/lesshat.les...') #3 /var/www/html/static/lessc.inc.php(1625): lessc->compileFile('css/lesshat.les...', 'css/lesshat.css') #4 /var/www/html/static/index.php(9): lessc->checkedCompile('css/lesshat.les...', 'css/lesshat.css') #5 {main} thrown in /var/www/html/static/lessc.inc.php on line 3144

Build script

We should make a build environment for this project and make some kind of dir structure for easier mixin maintenance.

Namespace for LESSHat

Maybe we should provide optional namespace for LESSHat, so it does not conflict with other libraries, like in #6.

LESS no longer requires escaping comma-separated values

LESS now supports semi-colon separated parameters. For single "values" that are comma separated, you can terminate with a semi-colon.

So, this example...

.example-background-size-2 {
    .background-size(~"100%, auto");
}

..can be converted to:

.example-background-size-2 {
    .background-size(100%, auto;);
}

...and so on.

Relative path with parent dir breaks border-image

Works fine:
.border-image(url(border.png) 61 45 62 54 repeat);
Result:
border-image: url(border.png) 61 45 62 54 repeat;

Broken:
.border-image(url(../images/border.png) 61 45 62 54 repeat);
Result:
border-image: url(../images/border.png), 61, 45, 62, 54, repeat;

opacity mixin rendering weird duplicate property

Nothing better than an example to explain my problem:
I have this in my less file:

#close-mask {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    .opacity(.3);
    background-color: @black;
}

and here is the result (compiled on server side, notice the opacity):

#close-mask {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    -webkit-opacity: 0.3;
    -moz-opacity: 0.3;
    opacity: 0.3;
    opacity: 0.003;                              /* what is that?? */
    filter: alpha(opacity=0.3);
    background-color: black;
}

Thanks in advance for anything you'll tell me to replace to try to make it work, I know less, but just using it for variables and simple mixins :-)

Problem about box-shadow & rgba

I'm insert .box-shadow(~"0 1px 10px rgba(20,20,20,0.5)"); in my code & auto complie with LiveReload.app or Less.app... but new css is return code to

-webkit-box-shadow: 0 1px 10px rgba(2020200.5);
-moz-box-shadow: 0 1px 10px rgba(2020200.5);
box-shadow: 0 1px 10px rgba(2020200.5);

How to fix it?
I'm used LESSHat ver. 1.0.6

Filter transition

When i write this:
.transition(~"filter .3s ease");

i get this:
-webkit-transition: -webkit-filter .3s ease;
-moz-transition: -moz-filter .3s ease;
-o-transition: filter .3s ease;
transition: filter .3s ease;

But chrome uses transition instead of -webkit- so that should be:
transition: -webkit-filter .3s ease;

or am i totally of on this?

Transtion mixin fails with webkit CSS filters

A mixin call like this:

.transition(~"transform 0.3s ease, filter 0.3s ease");

or

.transition(~"transform 0.3s ease, -webkit-filter 0.3s ease");

gives CSS like this:

-webkit-transition: -webkit-transform 0.3s ease filter 0.3s ease;
-moz-transition: -moz-transform 0.3s ease filter 0.3s ease;
-o-transition: -o-transform 0.3s ease filter 0.3s ease;
-ms-transition: -ms-transform 0.3s ease filter 0.3s ease;
transition: transform 0.3s ease, filter 0.3s ease;

The coma is present only in the un-prefixed version, should be everywhere.

Recreate .placeholder mixin

You can now use .placeholder mixin only for color change, but other useful properties like font-size aren't possible. Do it like .selection mixin and world would be nicer.

Using @variable to .gradient (~"image-1[, image-2, ..., image-n]");

Let me explain with an example:

// init

@primary: red;
@secondary: blue;

nav{
    .gradient(~"linear-gradient(0deg, @primary 0%, @secondary 100%)");
}


It compiles into:
nav{
    background-image: linear-gradient(0deg,@primary 0, @secondary 100%);
}

// end

Is there a way to make this mixin working with declared less variables?

.background-image() with multiple background images

I'm using LESS Hat 1.1.1.

I want to use multiple background images - logo on top of a gradient:

.container {
    .background-image(~'url(logo.png), linear-gradient(to bottom, #181b1e, #272d33)');
}

but as you can see, the result is incorrect (svg is not encoded in base64):

.container {
    background-image: url(logo.png),url(data:image/svg+xml;base64,<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" stop-color="#181b1e" stop-opacity="1"/><stop offset="100%" stop-color="#272d33" stop-opacity="1"/></linearGradient><rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" /></svg>);
    background-image: url(logo.png),-moz-linear-gradient(top, #181b1e, #272d33);
    background-image: url(logo.png),-webkit-linear-gradient(top, #181b1e, #272d33);
    background-image: url(logo.png),-o-linear-gradient(top, #181b1e, #272d33);
    background-image: url(logo.png),linear-gradient(to bottom, #181b1e, #272d33);
}

background-image with gradient and url

With this snippet:

#a { .background-image( linear-gradient(to bottom, green, black), url(bg.png) ); }
#b { .background-image( linear-gradient(to bottom, green, black) ); }

I get this:

#a {
  background-image: url(data:image/svg+xml;base64,[PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9ImdyYWQtdWNnZy1nZW5lcmF0ZWQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwODAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSI1MCUiIHN0b3AtY29sb3I9IiMwMDAwMDAiIHN0b3Atb3BhY2l0eT0iMSIvPil1cmwoYmcucG5nKTwvbGluZWFyR3JhZGllbnQ+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);
  background-image: -moz-linear-gradient(top, #008000, #000000), url(bg.png);
  background-image: -webkit-linear-gradient(top, #008000, #000000), url(bg.png);
  background-image: -o-linear-gradient(top, #008000, #000000), url(bg.png);
  background-image: linear-gradient(to bottom, #008000, #000000), url(bg.png);
}
#b {
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9ImdyYWQtdWNnZy1nZW5lcmF0ZWQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwODAwMCIgc3RvcC1vcGFjaXR5PSIxIi8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjMDAwMDAwIiBzdG9wLW9wYWNpdHk9IjEiLz48L2xpbmVhckdyYWRpZW50PjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+PC9zdmc+);
  background-image: -moz-linear-gradient(top, #008000, #000000);
  background-image: -webkit-linear-gradient(top, #008000, #000000);
  background-image: -o-linear-gradient(top, #008000, #000000);
  background-image: linear-gradient(to bottom, #008000, #000000);
}

And the generated SVG for #a decodes to this:

<?xml version="1.0" ?>
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">
    <linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="0%" stop-color="#008000" stop-opacity="1"/><stop offset="50%" stop-color="#000000" stop-opacity="1"/>)url(bg.png)
    </linearGradient>
    <rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" />
</svg>

The url is merged into the SVG instead of as a separate background value.

With a build script as per #15, I would have sent a pull request your way =)

Interpolate .blur mixin inside .keyframes mixin

Hey there,

I'm trying to add a blur filter to my keyframes and realized that the only way to do this through interpolation is writing out the blur properties by hand. Is there any clean way to add a blur filter to keyframes using the .blur mixin, even though the .keyframes mixin must be interpolated?

Any ideas?

.box-shadow breaks with negative first value and multipple shadows!

Just take the example code from the LESSHat site

.box-shadow(~"0 1px 10px #000, inset 0 -2px 5px red");

and use a negative value as the first parameter:

.box-shadow(~"-1px 1px 10px #000, inset 0 -2px 5px red");

The function breaks and produces wrong CSS code, making the shadow disappear.

Bug about background-image SVG/Base64 on IE9

I used CSSHAT and get code in CSS tab:

background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDg0IDI3IiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9ImhhdDAiIGdyYWRpZW50VW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiB4MT0iNTAlIiB5MT0iMTA1JSIgeDI9IjUwJSIgeTI9Ii01LjAwMDAwMDAwMDAwMDAyJSI+CjxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMzMjMyMzIiIHN0b3Atb3BhY2l0eT0iMSIvPgo8c3RvcCBvZmZzZXQ9IjQ5JSIgc3RvcC1jb2xvcj0iIzM1MzUzNSIgc3RvcC1vcGFjaXR5PSIxIi8+CjxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjNGE0YTRhIiBzdG9wLW9wYWNpdHk9IjEiLz4KPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjN2I3YjdiIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgPC9saW5lYXJHcmFkaWVudD4KCjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSI4NCIgaGVpZ2h0PSIyNyIgZmlsbD0idXJsKCNoYXQwKSIgLz4KPC9zdmc+);

background-image: linear-gradient(bottom, #323232 -5%, #353535 48.9%, #4a4a4a 50%, #7b7b7b 105%);

in LESS tab:
.gradient(~"linear-gradient(bottom, #323232 -5%, #353535 48.9%, #4a4a4a 50%, #7b7b7b 105%)");

and when generate to css is show as

background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMSAxIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIj48bGluZWFyR3JhZGllbnQgaWQ9ImdyYWQtdWNnZy1nZW5lcmF0ZWQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMCUiIHkxPSIxMDAlIiB4Mj0iMCUiIHkyPSIwJSI+PHN0b3Agb2Zmc2V0PSIiIHN0b3AtY29sb3I9IiMzMjMyMzIiIHN0b3Atb3BhY2l0eT0iMSIvPi01JTxzdG9wIG9mZnNldD0iNDgiIHN0b3AtY29sb3I9IiMzNTM1MzUiIHN0b3Atb3BhY2l0eT0iMSIvPi45JTxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjNGE0YTRhIiBzdG9wLW9wYWNpdHk9IjEiLz48c3RvcCBvZmZzZXQ9IjEwNSUiIHN0b3AtY29sb3I9IiM3YjdiN2IiIHN0b3Atb3BhY2l0eT0iMSIvPjwvbGluZWFyR3JhZGllbnQ+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz48L3N2Zz4=);

In this result can't show gradient color in IE9, SVG code is not same as generate SVG on CSS tab (CSSHAT) How do I fix it?

Suggestion for calc()

@csshat Does LESSHat support calc()? #LESSHat

@great_potato Hi Aaron, what usage exactly do you have in mind?

@csshat There doesn't seem to be a mixin for it at all and I use LESSHat to avoid prefixing...

@csshat It's a bit of a weird one though as calc() is a value and not a property, so not sure how you could implement it.

@great_potato Well, that really is not supported. But its a nice idea, we are gonna try to make it happen in the next version...

@csshat I guess maybe something such as .width(~"50% - 20px", ~"500px") with the second value being a fall back? Just an idea. Tricky one.

LESSHat Sources

Hi Team,

I wanted to fork this project and help you with some fixes and improvements. But do you have some more sources to commit (publish)? As those, that are in build branch, are really difficult to maintain. Especially the javascript part - in lesshat.less there are many minified scripts. You have published some scripts for transitions, but they are also looking as to be compiled and minified versions of the source in coffeescript. So if you have all the sources and publish them, we could give a fresh breeze to the project.

Regards, Alex

keyframes mixin does not work with rgba colors

When I try to define a color using rgba in the keyframe mixin, the resulting CSS is incomplete. For example, the following:

.keyframes(~'background-fade, 0%{ background-color : rgba(255,255,102,1);} 100%{ background-color : rgba(255,255,102,0);}');

Will result in:

lesshat-selector {
  -lh-property: 0; } 
@-webkit-keyframes background-fade{ 0%{ background-color : rgba(}
@-moz-keyframes background-fade{ 0%{ background-color : rgba(}
@-o-keyframes background-fade{ 0%{ background-color : rgba(}
@keyframes background-fade{ 0%{ background-color : rgba(;
}

.font-face

The .font-face is adding "-webfont".filetype to the end of the filename.

This:
.font-face(LyonText-Regular , ~'../fonts/LyonText-Regular-Web', normal, normal);

Becomes:
font-family: "LyonText-Regular";
src: url("../fonts/LyonText-Regular-Web-webfont.eot");
src: url("../fonts/LyonText-Regular-Web-webfont.eot?#iefix") format("embedded-opentype"), url("../fonts/LyonText-Regular-Web-webfont.woff") format("woff"), url("../fonts/LyonText-Regular-Web-webfont.ttf") format("truetype"), url("../fonts/LyonText-Regular-Web-webfont.svg#LyonText-Regular") format("svg");
font-weight: normal;
font-style: normal;

SVG gradient for IE9 doesn't get turned into data-uri

On Windows, if I load LESS client-side on IE9, the SVG gradients get compiled to something like this, instead of data-uri, which makes it not render:

background-image:url('data:image/svg+xml;utf8,<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" stop-color="#1e5799" stop-opacity="1"/><stop offset="50%" stop-color="#2989d8" stop-opacity="1"/><stop offset="51%" stop-color="#207cca" stop-opacity="1"/><stop offset="100%" stop-color="#7db9e8" stop-opacity="1"/></linearGradient><rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" /></svg>');

Now this wouldn't be so much of an issue, since you're not supposed to use LESS client-side in production. The problem is that we use this tool on Windows to compile less: https://github.com/duncansmart/less.js-windows , and it uses the same rendering engine as IE, thus it produces the same code as above.

Basic gradients

Feature request !

Because I was only using very basic CSS gradients in most of my designs, I wrote some shorthand for vertical, horizontal and radial 2 steps gradients. Here's what I use for now :

.gradient-vertical( @start_color , @end_color ) {
    background-image: linear-gradient( center bottom, @end_color 0%, @start_color 100% );
    background-image: -ms-linear-gradient( center bottom, @end_color 0%, @start_color 100% );
    background-image: -moz-linear-gradient( center bottom, @end_color 0%, @start_color 100% );
    background-image: -webkit-gradient( linear, 0% 0%, 0% 100%, from( @start_color ), to( @end_color ) );
    background-image: -o-linear-gradient( center bottom, @end_color 0%, @start_color 100% );
}

.gradient-horizontal( @start_color , @end_color ) {
    background-image: linear-gradient( left center, @end_color 0%, @start_color 100% );
    background-image: -ms-linear-gradient( left center, @end_color 0%, @start_color 100% );
    background-image: -moz-linear-gradient( left center, @end_color 0%, @start_color 100% );
    background-image: -webkit-gradient( linear, 0% 0%, 100% 0%, from( @start_color ), to( @end_color ) );
    background-image: -o-linear-gradient( left center, @end_color 0%, @start_color 100% );
}

.gradient-radial( @start_color , @end_color ) {
    background-image: -webkit-radial-gradient(50% 50%, ellipse cover, @start_color, @end_color 100%);
    background-image: -moz-radial-gradient(50% 50%, ellipse cover, @start_color, @end_color 100%);
    background-image: -o-radial-gradient(50% 50%, ellipse cover, @start_color, @end_color 100%);
    background-image: -ms-radial-gradient(50% 50%, ellipse cover, @start_color, @end_color 100%);
    background-image: radial-gradient(50% 50%, ellipse cover, @start_color, @end_color 100%);
}

I know there's already a .background-image() mixin, but those ones are much easier to write and remember. What do you think ?

Non-cross-browser gradients

Hello guys! Appreciate your work. Less hat is awesome.

But it seems background-image mixin isn't cross-brower. Today I got some issues at Android 2.3 native browser. A gradient wasn't applied because there is no -webkit-gradient in the mixin. Nonetheless it is necessary.

Here is a gradient from less hat:
background-image: url(data:image etc);
background-image: -webkit-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
background-image: -moz-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
background-image: -o-linear-gradient(top, #fb83fa 0%, #e93cec 100%);
background-image: linear-gradient(to bottom, #fb83fa 0%, #e93cec 100%);

Here is the gradient from http://www.colorzilla.com/gradient-editor/ it works perfectly.

background: #1e5799; /* Old browsers /
background: -moz-linear-gradient(top, #1e5799 0%, #7db9e8 100%); /
FF3.6+ /
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(100%,#7db9e8)); /
Chrome,Safari4+ /
background: -webkit-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /
Chrome10+,Safari5.1+ /
background: -o-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /
Opera 11.10+ /
background: -ms-linear-gradient(top, #1e5799 0%,#7db9e8 100%); /
IE10+ /
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 100%); /
W3C /
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /
IE6-9 */

Regards

Keyframes - multiline

Hi LESSHat team,

as I have understood, multiline keyframe declaration is not possible, due to LESS parser? Or is there a workaround for this?

.keyframes(~'
    foo,
    from { opacity: 0 }
    to { opacity: 1 }
');

I also created a PR for less.js repo, so that also multiline strings are supported.

Add mixin for applying linear-gradient as background

I need to define the following css styles:

  p  {
     background: -moz-linear-gradient(top,  rgba(254,193,81,1) 0%, rgba(254,231,154,1) 100%);
     background: -webkit-linear-gradient(top,  rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
     background: -o-linear-gradient(top,  rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
     background: -ms-linear-gradient(top,  rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
     background: linear-gradient(top,  rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fec151', endColorstr='#fee79a',GradientType=0 );
  }

But I can't find mixin for this purpose. May you add this one?

IE9 svg gradient doesn't work without percentages

this doesn't work (it just displays one of the colors):
.gradient(~"linear-gradient(to bottom, #ececec, #dddddd)");

but this does work:
.gradient(~"linear-gradient(to bottom, #ececec 0%, #dddddd 100%)");

the example in lesshat.less is:
// element{ .background-image(linear-gradient(to bottom, #ffffff, #929292)); }

seems like either the example should change (to reflect that percentages are required) or the functionality should change to work for IE without percentages

in case it matters, i'm testing lesshat 1.1.1 with IE9 (in standards mode)

Broken diagonal background-image gradients

Hi,

When using the background-image mixin, the SVG output doesn't respect many directional declarations, as defined in the CSS3 gradient spec. Also, any extra directions are ignored when using the to dx dy format, which outputs essentially as !dx dy (inverse x, normal y) when it should invert both.

Broken in SVG (Legacy format for non-standard implementations)

  • top left
  • top right
  • bottom left
  • bottom right

Broken with standard syntax (W3C first >> legacy values for prefixed):

  • to top left >> bottom right
  • to top right >> bottom left
  • to bottom left >> top right
  • to bottom right >> top left

I'm totally willing to implement this, but the obfuscated javascript chunk is difficult to work with (see #28).

Mixin:

.background-image(linear-gradient(to top left, #000 0%, #FFF 100%));

output css:

background-image: url(<base64>);
background-image: -moz-linear-gradient(bottom left, #000 0%, #FFF 100%);
background-image: -webkit-linear-gradient(bottom left, #000 0%, #FFF 100%);
background-image: -o-linear-gradient(bottom left, #000 0%, #FFF 100%);
background-image: linear-gradient(to top left, #000 0%, #FFF 100%);

output svg before base64 encoding:

<?xml version="1.0" ?>
    <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">
        <linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="100%" x2="0%" y2="0%"> left
            <stop offset="0%" stop-color="#000000" stop-opacity="1"/>
            <stop offset="100%" stop-color="#ffffff" stop-opacity="1"/>
        </linearGradient>
        <rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" />
</svg>

Attention will also need to be given to using angle values and the differences between vendors, though I haven't tried using them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.