lesscap
Add LESSHat mixins to your LESS. Helpful if you are planning to convert your existing code to make use of LESSHat. Also known as the first CSS pre-preprocessor.
Installation
npm install -g lesscap
Usage
Command line
lesscap < ./input.less > output.lesslessc output.less > styles.css
Code
fs.createReadStream('input.less')
.pipe(new LESSCap())
.pipe(fs.createWriteStream('output.less');
Example
input.less
input:
@import "./lesshat-prefixed";
body {
font-size: 10px;
keyframes: appearance, 0% { opacity: 0.5; } 100% { opacity: 1; };
animation: appearance 2s ease;
}
a {
color: blue;
transition: color 1s ease;
&:hover {
color: lightblue;
}
}
div {
@gradient-colour: #3d6d1f;
background-image: linear-gradient(to bottom, @gradient-colour 0%, saturate(@gradient-colour, 10%) 100%);
}
Will produce this output.less
:
@import "./lesshat-prefixed";
body {
font-size: 10px;
.lh-keyframes(~'appearance, 0% { opacity: 0.5; } 100% { opacity: 1; }');
.lh-animation(appearance 2s ease);
}
a {
color: blue;
.lh-transition(color 1s ease);
&:hover {
color: lightblue;
}
}
div {
@gradient-colour: #3d6d1f;
.lh-background-image(linear-gradient(to bottom, @gradient-colour 0%, saturate(@gradient-colour, 10%) 100%));
}
Which will compile into this styles.css
:
@- 100% }@- 100% }@- 100% }@ 100% ;}
Requirements
- Indent your style with tabs
- One property per line