Open bguiz opened 9 years ago
If you use css as the output format css-sprite will generate the classes for you. When using a pre-pocessor like scss it just generates the needed mixins.
Or you could also create your own template for generating scss. Have a look at the templates that come with css-sprite in lib/templates.
Yup, I am aware of that.
The thing is that I am not sure why that should be the case. Generally I want to have sprite classes generated for every single sprite that is inside the output image.
It is quite a simple addition to the basic template too, like I have done here: https://github.com/bguiz/node-angularity/blob/feature/sprites/tasks/sprites.scss.mustache#L51-L53
I know I can always create a custom template, just think that this should be the default behaviour.
On 5 February 2015 at 20:23, Alexander Slansky notifications@github.com wrote:
Or you could also create your own template for generating scss. Have a look at the templates that come with css-sprite in lib/templates.
— Reply to this email directly or view it on GitHub https://github.com/aslansky/css-sprite/issues/44#issuecomment-73016854.
Yeah ok. We have different opinions about that. I want to keep the generated styles as small as possible, but I can see why this would be helpful. I'll reopen the issue a a reminder for me. Right now I am just filled up with work stuff.
I just had to do something simmilar in a project I'm working on. I would suggest creating your own template and using something like this at the end of your template
{{#items}}
.icon-{{name}}
@extend .icon
sprite(${{name}})
{{/items}}
I agree with @aslansky that the generated styles should be as small as possible. I feel it should be left to individuals to create their own concrete-classes via the template mechanism.
EDIT: Sorry, I should have read the comments more closely - it appears you've already arrived at this solution.
I could be wrong about this, but the SCSS that is output does not appear to include the actual class names for each of the generates sprites.
Using the follwing options (as part of a gulp stream):
The following files do get generated correctly within 'build/sprite':
However, the contents of
_sprite.sccs
is as follows:It appears that the required mixins and functions are all in place, however the onlty "instantiated" or "concrete" CSS classes generated are:
.icon
, and@media ... .icon
The dimension variables that were defined right up the top,
$main-logo
and$js-logo
have not been used in any of the mixins or functions to generate actual classes.In the usage section for SCSS, we have the instrucrtions:
However, wouldn't it be easier to simply generate the classes automatically rather than require that they be done by hand?