1

I have a standard Jekyll setup and use sass to compile some CSS. But I can't figure out how to inline the compiled CSS while still using the default directory structure. Current I have this code in my _includes/head.html file:

<link rel="stylesheet" href="{{ "/assets/normalize.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/milligram.css" | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/foobar.css" | relative_url }}">

Here is the directory structure:

_sass
├── milligram
│   ├── _Base.sass
│   ├── _Blockquote.sass
│   ├── _Button.sass
│   ├── _Code.sass
│   ├── ...
└── milligram.sass
assets
├── milligram.scss
├── normalize.css
└── foobar.css

How can I do something like:

<style type="text/css">
  {% include normalize.css %}
  {% include milligram.css %}
  {% include foobar.css %}
</style>

Which doesn't work in the default directory structure because all those files are not in the _includes directory.

wintermeyer
  • 8,178
  • 8
  • 39
  • 85

1 Answers1

1

Have you tried adding the assets folder to the include option in your _config.yaml configuration file?

include: - assets

It's a slightly different question and usage but there's a few other things you can try over at Jekyll: Include a file from directory outside of _includes

Matthew
  • 1,300
  • 12
  • 30