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

Images invisible to Middleman during CSS build phase #1172

Closed
GSI opened this Issue Feb 7, 2014 · 3 comments

Comments

Projects
None yet
3 participants

GSI commented Feb 7, 2014

In a file named stylesheets/deferred.css.scss.erb I have the following code:

// image-preloader
body:after {
  content: url() <% image_resources_in('thumbs', true).each do |img| %>
                   <%= " url(#{img.path}) " %>
                 <% end %>;
  display: none;
}

Now at the moment the Ruby-part is executed, Middleman seems to be unable to see the images and thus the Enumerable is empty and nothing is written.

NOTE The very same code works perfectly fine in middleman server.
Also, the snippet is tested to work fine within .html.erb files (in both, server and build).

Can this be resolved directly in Middleman in order to achieve consistency over the two environments?

Is there a workaround that allows me the keep the definitions in the CSS?
(I want to avoid having HTML elements with style attributes.)

Owner

tdreyno commented Feb 8, 2014

What is image_resources_in? Does it use the sitemap under the hood?

GSI commented Feb 8, 2014

Thomas, it's a modified variant of Aupajo's code posted in the forum:
http://forum.middlemanapp.com/t/direct-image-tag-to-look-in-the-current-directory/1084/2

Yes, it uses sitemap.resources.
(The modifications are basically some conditions, so the same problem should occur with his code.)

Contributor

sandstrom commented Nov 9, 2016

I'm doing some issue-gardening 🌿🌷🌾 and came across this issue.

Since 4.0 the primary handling of advanced pre-processing of assets is to use an external pipeline. I'd suggest that this issue is closed.

@tdreyno tdreyno closed this Nov 19, 2016

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