Skip to content

Insert a css or js file in a manifest stored in a page variable #18

Open
@fcalderan

Description

@fcalderan

I'd like to define a specific css for a single included page in this way


---
layout: default.html
css: page.css.scss

---
My customized page

and in my layout page I'd like to add this custom css like so

<!-- layout style -->
{% css_asset_tag global %} 
- /_assets/css/test.css.scss   <-- this works correctly
 {% endcss_asset_tag %}

<!-- page style -->
/_assets/css/{{ page.css }} <-- this correctly print /_assets/css/page.css.scss

{% if page.css %}
    {% css_asset_tag local %}
- /_assets/css/{{ page.css }}  <-- this fails
    {% endcss_asset_tag %}
{% endif %}

but when I run jekyll I've got an error:

Configuration from /Users/fcalderan/www/root/jekyll/_config.yml
Building site: ./src -> ./static
Asset Pipeline: Processing 'css_asset_tag' manifest 'global'
Configuration from /Users/fcalderan/www/root/jekyll/_config.yml
Configuration from /Users/fcalderan/www/root/jekyll/_config.yml
Asset Pipeline: Saved 'test.css' to '/Users/fcalderan/www/root/jekyll/static/css'
Asset Pipeline: Processing 'css_asset_tag' manifest 'local'
Asset Pipeline: Failed to load assets from provided manifest.
Liquid Exception: Is a directory - /Users/fcalderan/www/root/jekyll/src/_assets/css/ in default
...

I'm not sure but I suppose the interpolation of the string with the css filename is failing inside {% css_asset_tag %} block. There's a way to include a custom style or is it not possible? Or there's a better way to achieve the same result?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions