envygeeks / jekyll-assets

:art: Asset pipelines for Jekyll.
ISC License
1.11k stars 169 forks source link

Need a way to @inline css styles without automatically wrapping them in <style> tags #540

Open PMLavigne opened 6 years ago

PMLavigne commented 6 years ago
ruby: 2.3.3

jekyll: 3.8.1
jekyll-assets: 3.0.11
sprockets: 3.7.1

Description

I have an SVG file that is dynamically built from a liquid template. I also have a separate scss file that contains styles related to the SVG. For most things to display the SVG correctly, the styles need to be embedded directly into the SVG instead of loaded externally. Additionally, everything in the SVG file must be valid XML, so the embedded styles either need to be properly escaped or wrapped in a <![CDATA[ ]]> block.

I've tried doing something like this:

<style type="text/css">
    <![CDATA[
    {% asset "logo.scss" @inline %}
    ]]>
</style>

But jekyll-assets seems to automatically add a wrapping