Skip to content

Fixes sprite magic import#284

Open
tkhyn wants to merge 12 commits intoKronuz:masterfrom
tkhyn:import_sprite
Open

Fixes sprite magic import#284
tkhyn wants to merge 12 commits intoKronuz:masterfrom
tkhyn:import_sprite

Conversation

@tkhyn
Copy link
Copy Markdown
Contributor

@tkhyn tkhyn commented Jun 23, 2014

Hi there,

While discovering and playing with pyScss to see if I could implement / plug in a little project of mine *, I noticed that the @import rule used with png files was completely broken, with remnants from old code (such as rule.context) that showed that the _at_magic_import had been forgotten for a little while.

I attempted to fix all that to get the correct compass behavior, and added the missing sprite_does_not_have_parent and sprite_has_selector functions referenced in the compass library for 'magic sprites' (http://compass-style.org/help/tutorials/spriting/magic-selectors/, this uses https://github.com/Compass/compass/blob/stable/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss).

Before that, I also fixed some issues with the windows file separators, using os.sep wherever possible / applicable (i.e. not when the input was an URL). Some of them were only for test success, others were bugs.

Note: Before merging, please check that these commits do not break the fonts.scss test, this is the only one I did not run (would have had to build fontforge with python bindings on windows and that bored me).

* the idea is to integrate an automatic SVG spriting mechanism that would work the same way as PNG spriting except it would optimize the SVGs first as well as generate PNG fallback sprites for incompatible browsers. I already have some python code to do that independently but now I want to be able to do @import "icons/*.svg"; in my SCSS.

tkhyn added 3 commits June 24, 2014 00:11
--HG--
branch : import_sprite
extra : amend_source : 827ba5ccd5408ded9faaf329c6d4c52304f96a98
@Kronuz
Copy link
Copy Markdown
Owner

Kronuz commented Jun 24, 2014

Check the fonts.py. I'm using fontforge for building fonts from svg files (much in the way sprite maps work, but generating font files). Also, for svg, I've usted pycairo which has worker pretty well for me.

@tkhyn
Copy link
Copy Markdown
Contributor Author

tkhyn commented Jun 24, 2014

Ok. Will have a look at how fonts are generated to pick some ideas, thanks.
I indeed use cairo and rsvg for svg to png conversion (and scour for svg optimisation).

tkhyn added 3 commits June 29, 2014 18:25
--HG--
branch : import_sprite
and properly fixed the issue that was introduced by commit 6c00584a0dab

--HG--
branch : import_sprite
@tkhyn
Copy link
Copy Markdown
Contributor Author

tkhyn commented Aug 4, 2014

Feel free to let me know if there is anything that needs to be done on my side - or that you don't like, or that is not in the project's philosophy, or whatever - about this sprite import fix. Merging it with the current master branch is straightforward.

Btw, on the basis of this fix I have SVG spriting working in beta on my svg_sprite branch, using pyconizr which I'm developing in parallel. You may want to check it out, not much customization options yet (actually none, that'll come), but it does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants