2createStudio / postcss-sprites

Generate sprites from stylesheets.
MIT License
413 stars 50 forks source link

Generate all images from several html file into one sprite sheet? #54

Closed YingshanDeng closed 8 years ago

YingshanDeng commented 8 years ago

I have some problem which can not generate all images from several html file into one sprite sheet? Now I only can genrate sprite sheet from one file, my demo: https://github.com/YingshanDeng/polymer-generate-spritesheet

Can you give me some guide? Thank you! 😃

vvasilev- commented 8 years ago

To get single sprite from all <style> tags you need to pass them as single source. Probably you need something like posthtml-collect-styles to combine all styles into single source which can be processed by the plugin.

YingshanDeng commented 8 years ago

@vvasilev- Thank you for your reply. In my project, using the Polymer, after build the release file, it look like:

<html>
<head></head>
<body>
    <dom-module>
        <template>
            <style>
                /*... */
            </style>
        </template>
    </dom-module>
    <dom-module>
        <template>
            <style>
                /*... */
            </style>
        </template>
    </dom-module>
    <dom-module>
        <template>
            <style>
                /*... */
            </style>
        </template>
    </dom-module>
    <!-- other dom-module  -->
</body>

</html>

And it can not collect all style tags together.

vvasilev- commented 8 years ago

I understand that you need separate <style> tags in the final output(I cloned your repo and ran the build process) but my idea was:

You need to do something like the steps above because the final result that you want isn't in scope of this project. :smile:

YingshanDeng commented 8 years ago

Ok, thank you very much! 😎