Code Monkey home page Code Monkey logo

Comments (4)

addyosmani avatar addyosmani commented on August 17, 2024

This should be fixed in master now :)

from critical.

micahblu avatar micahblu commented on August 17, 2024

Hi @addyosmani thanks for the merge, happy to help. I don't believe we have fixed this particular issue. I have a fix and I'll do my best to explain.

There are actually two issues here. The first is that there is not an option to set a max image file size for in-lined images. Google page speed kept complaining about prioritizing my atf content and I found that it was indeed an in-lined background image causes this. So I built in an option to set the max file image size and once I did that I was able to skip images that were too large and keep round trips for atf content to a minimum. Google was happy.

However in doing this I re-encountered this #24 issue which is that in the event images are not in-lined, the relative css paths are no longer referencing the proper paths. To be clear I am speaking of fonts and images paths which are not being in-lined by image inliner. My previous pr gave the image inliner module the proper path to work with it so it could inline those images but does nothing to workout the new relative paths for these resources once their in-lined into a html file that is outside the root css dir.

So for example If I have a stylesheet located at root/stylesheets/styles.css and an image directory at root/img/

Then the following styling rule will fail to locate the proper image path once in-lined, assuming the html file is not in the stylesheets dir..

background: url(../img/mypic.jpg);

It would also fail even if img folder was in the stylesheets dir and we had

background: url(img/mypic.jpg);

When referenced from let's say root/index.html those paths are not valid. The behavior is the same for fonts.

I have written a fix for this which, essentially re-bases the relative path based on the base path set by configuration or cwd.

I'll shoot over a pr after I set up some tests

from critical.

addyosmani avatar addyosmani commented on August 17, 2024

Issue re-opened. Thanks for the detailed feedback!

from critical.

bezoerb avatar bezoerb commented on August 17, 2024

This should be fixed by now. Feel free to re-open if there are still issues we did not consider yet.

from critical.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.