Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images used only with asset_path in sass are not getting included in build. #261

Closed
devm33 opened this issue Apr 10, 2016 · 16 comments
Closed

Comments

@devm33
Copy link
Contributor

devm33 commented Apr 10, 2016

Hey there,

Please do let me know if I'm doing something wrong here, but it looks like there's an issue with including files when called from the sass helper function asset_path.

Here's an example of what I'm talking about

background: url(asset_path("vsm_bg.jpg")) no-repeat center center fixed transparent;

Then the vsm_bg.jpg image is not include in the build _site directory. Oddly enough in the rendered css file the asset_path is completed with the digested path:

background: url("/assets/vsm_bg-a3f15e166cebad41de9e90d8d138d08b41ff623378c73e1df8c400b261ff7830.jpg") no-repeat center center fixed transparent;

My site is on github you can see the full source here https://github.com/devm33/devm33/tree/master/ln
and the line of sass I'm talking about here https://github.com/devm33/devm33/blob/master/ln/_assets/css/main/_landing.scss#L6

Thanks

@envygeeks
Copy link
Owner

They should work, as they should be flagged as they should go through our system but I'll double check.

@envygeeks envygeeks added the bug label Apr 14, 2016
@envygeeks
Copy link
Owner

Hulk: Today

@envygeeks envygeeks added this to the v2.2.0 milestone Apr 14, 2016
@envygeeks envygeeks self-assigned this Apr 14, 2016
@envygeeks
Copy link
Owner

Unfortunately I am not able to reproduce this, please provide more information, including your build logs.

@devm33
Copy link
Contributor Author

devm33 commented Apr 16, 2016

Hey @envygeeks thank you so much for looking into this and for adding that test!

I may be misunderstanding the test, but could there be a difference between including the image file in css vs using the sass helper function?

I created a minimal example site to reproduce the issue here https://github.com/devm33/missing-jekyll-assets-issue In doing so I realized that the steps to reproduce are actually:

  1. build the site
  2. rm -rf _site output directory
  3. build the site

So perhaps this an issue with the .asset-cache directory?

@envygeeks
Copy link
Owner

No there couldn't be (well, let me rephrase that as shouldn't,) because they are the exact same helpers using the exact same code (as far as I'm aware.) That said though, I'm happy to fork the source and see what I can find out by shimming it.

Thanks for providing some source!

@devm33
Copy link
Contributor Author

devm33 commented Apr 17, 2016

No problem! Hope that's useful. I've been digging a bit more into this and it's not limited to sass files the same thing also happens to js files that have an asset_path or similar in them. It seems html includes are cached differently (perhaps not cached?)

@envygeeks
Copy link
Owner

We cache all JS and CSS files regardless of whether they have liquid and let upstream bust them but that doesn't affect what happens in processing and it doesn't affect what happens with Liquid AFAIW. I guess we'll find out.

@envygeeks
Copy link
Owner

I've audited my code and found where I think this is happening. It seems that unless we render a tag we don't add it to the used list, I actually discovered this while optimizing for manifests, so this should be fixed today with the release going out.

@envygeeks
Copy link
Owner

It turned out now to be that, yeah I cannot replicate this, no matter what I try. I even verified our tests and it turns out we explicitly test for this behavior in our specs.

@envygeeks envygeeks removed this from the v2.2.0 milestone Apr 29, 2016
@envygeeks envygeeks removed their assignment Apr 29, 2016
@envygeeks
Copy link
Owner

I'm gonna double check this tonight once again before I drop v2.2.1

@envygeeks envygeeks added this to the v2.2.1 milestone Apr 29, 2016
@envygeeks
Copy link
Owner

Hi, I've double checked this site by pulling down your source and was again unable to replicate the issue, the JPG was properly written for me. So I'm going to close this for now. If you continue to have the problem please provide more information if you can. This might have been accidentally fixed on master before I realized it too.

@arron-paul
Copy link

Hi. I’ve just had the exact same problem after reinstalling OS X and moving/relocating both my repository and working copy.

The solution that worked for me was to rm -rf both the .sass-cache and .asset-cache directories.

@devm33
Copy link
Contributor Author

devm33 commented May 23, 2016

Fyi @arron-jeffery I've been using git clean -dfX to knock out those birds with one stone

see this script https://github.com/devm33/devm33/blob/master/ln/_local

hope that helps 😄

@rbmntjs
Copy link

rbmntjs commented Jun 14, 2016

I am having the same issue as described: any files referenced only from the SCSS don’t actually generate on jekyll serve (in my case, font files and SVGs). It does work when building. I tried to nuke the .cache folders, but to no avail.

@envygeeks
Copy link
Owner

@rbmntjs please provide a working case (a repository that can be cloned to have my bot test it) and I'll happily test it and see if I can reproduce the problem and reopen this ticket if I can reproduce. Otherwise a "I had this problem too" helps little in solving an unreproducable bug.

Thanks!

@amk221
Copy link

amk221 commented Jun 16, 2016

I'm new to jekyll & jekyll-assets, and with a fresh project am also experiencing this.
(I'm afraid I don't have anything more useful to add to the discussion right now!)

Repository owner locked and limited conversation to collaborators Jun 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants