Reputation: 51
The "Embedded Engines" section of the official Slim docs claim that the using the css
, scss
, or sass
filters will have Slim generate a <style>
tag containing the described css. Their example:
scss class="myClass":
$color: #f00;
body { color: $color; }
This will generate the following HTML:
<style class="myClass" type="text/css">body{color:red}</style>
When I use this example code verbatim in my template, Slim does not generate a style
tag. Rather, it applies the styles in-line to any elements matching the written selectors. Thus:
scss class="myClass":
$color: hot pink;
body { color: $color; }
body "some text"
In fact generates the following HTML:
<body style="color: hotpink">some text</button>
I'm using Slim 4.0.1, slim-rails 3.2.0, and rails 5.2.2, which are all the most recently released versions of these libraries as of this writing. There are no custom configurations written that I know of.
How do I get the behavior described in the docs, wherein a <style>
tag is generated? Is this a bug or something I'm not understanding?
Upvotes: 1
Views: 2726
Reputation: 1895
not sure what you are using but I got:
<style class="myClass" type="text/css">body{color:red}</style></div></body></html>
with:
scss class="myClass":
$color: #f00;
body { color: $color; }
looks like you have some kind of inliner running on your generated pages (I would check the Gemfile for the gem).
Upvotes: 0