1

i just started using craft on a local domain and i have some issues. my stylesheet(a few files) are loaded using html<link rel="stylesheet" href="style/style.css">, and it works great for css and js files, but files requested from within the css aren't loading. for example the Font Awesome @fontface.

Any ideas? and the is any issue using html instead of the {{ getHeadHtml() }} method?

Thanks Ahead!

5
  • 3
    Have you tried using root relative paths? /style/style.css instead of style/style.css? – Steve Adams Jul 25 '15 at 20:26
  • yes, iv'e tried – Samuel E. Jul 25 '15 at 23:05
  • 1
    How about in the CSS file itself? What do your selector: url(path); look like? – Steve Adams Jul 25 '15 at 23:19
  • its relarive: url(url/to/some/path); – Samuel E. Jul 26 '15 at 9:56
1

For static assets I usually use something like this:

{% if craft.debugMode %}
    {% set assetsUrl = siteUrl %}
{% else %}
    {% set assetsUrl = "assets.mysite.com" %}
{% endif %}

And then I can set assets URL's the same way as navigation URLs. ie.

{% includeJsFile assetsUrl ~ "js/init.js" %}

{% includecss %}
body.landing #page-wrapper {
    background-image: url(" {{ assetsUrl }}img/pic01.jpg  }}");

}
{% endincludecss %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.