asciidisco / grunt-imagine

Grunt tasks for optimizing & inlining images
MIT License
153 stars 21 forks source link

Add option to output SCSS, SASS and LESS for the sprites task #31

Closed LaurentGoderre closed 11 years ago

LaurentGoderre commented 11 years ago

This would allow to leverage this without being bound to the images filenames

The task output would be:

%icon36{
    background: url("../img/icon36.png") no-repeat;
}

%MyImage1 {
    @extend %icons36;
    background-position: 0 -432px;
}

%MyImage2{
    @extend %icons36;
    background-position: 0 -396px;
}

Which would allow us to use it like this:

.myclass p .btn {
   @extend: %MyImage1;
}

.myclass2 p {
    @extend: %MyImage2;
}

.myclass3 {
    @extend: %MyImage2;
}

Which would output the following:

.myclass p .btn, .myclass2 p, .myclass3 {
    background: url("../img/icon36.png") no-repeat;
}

.myclass p .btn {
    background-position: 0 -432px;
}

.myclass2 p, .myclass3 {
    background-position: 0 -396px;
}
LaurentGoderre commented 11 years ago

Landed in #32