Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Open
fcalderan opened this Issue Feb 21, 2013 · 1 comment

Comments

Projects
None yet
2 participants

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.

Owner

matthodan commented Feb 21, 2013

I'm afraid you are right. It looks like the asset manifest is being processed before liquid tags within the manifest. I'm not sure how you can get around this, but let me know if you find a solution. I would be happy to update the lib with your solution or revise the docs to explain a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment