Responsive Images as described on Book (Theme dev with Sage)

Hey everyone. I have a question regarding Sage and responsive images. Recently got to work with roots and got that book “Theme dev with Sage” third Edition, where there is a chapter called “Responsive images & post thumbnails” which explain how to activate responsive images on the template by going under app and the setup file and adding a line of code, however in my version I couldn’t find this file. Tried add it manually however, it did not work. I was looking at the package.json and I realized that we have “@roots/sage”: “6.20.0”, but the book describe configurations for sage 9.0.0 and is from 2018. We adquired roots about more than a month already(March -February 2024), and I’m wondering if I actually can enable this feature. Can someone please answer this question, also when not possible suggestion are very welcome.

Thank you in advance for your answer :slightly_smiling_face:

Howdy!

6.20.0 is actually the version of bud.js that you’re using — you can see what version of Sage that you’re using by referencing style.css

While the Sage book is for Sage v9, a lot of the same principals still apply to Sage v10. app/setup.php still exists in Sage v10, but Controllers do not and have been replaced with View Composers.

You might be interested in taking a look at GitHub - clarifynl/responsive-pics: Wordpress plugin that enables theme authors to automatically resize images in responsive layouts

1 Like

Thank you for the information and reading me, good to know. Funny to say for me, not sure why…(for me) in style.css I only get “Theme Name: Radicle”.

Well insteresting because there not such a file called setup.php for me under the app folder :-/ I’m afraid …(as I explained before I tried to add it but made nothing)

In the first instanse I will be interested in applying something that’s coming with roots+sage, when not possible well… will have to do it myself. I again appreciated your advice

Since you’re using Radicle, you could use one of the existing service providers in app/Providers or you could create a new one

What do you mean with using an existing service Provider? Where I can read more about that for this particular case or similar? Thank you very much in advance for the help

https://roots.io/radicle/docs/service-provider-configuration/