What method would you use to convert the following css into more dry less code:
nav ul,
nav ol,
ul.reset,
ol.reset {
list-style: none;
margin: 0;
padding: 0;
}
This is the best I could think of:
.resetList() {
list-style: none;
margin: 0;
padding: 0;
}
nav {
ul, ol {
.resetList;
}
}
ul, ol {
&.reset {
.resetList;
}
}
However because of the way mixins work the above would compile to this:
nav ul,
nav ol {
list-style: none;
margin: 0;
padding: 0;
}
ul.reset,
ol.reset {
list-style: none;
margin: 0;
padding: 0;
}
So I would agree with @ascii-lime that pure CSS is probably the better route for something this simple. Hopefully less will provide an alternative in the future.
It won't help much if you want to convert it into LESS.
The code will instead become longer by using LESS techniques. It's better to keep it the way it is.
If you still wish to do this, you can try this:
nav {
list-style: none;
margin: 0;
padding: 0;
ul, ol {
list-style: none;
margin: 0;
padding: 0;
&.reset {
list-style: none;
margin: 0;
padding: 0;
}
}
}
.reset classes to be children of a <nav> element to be styled, and your example is nothing close to being dry.