Closed (fixed)
Project:
Custom CSS and JavaScript files
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Oct 2009 at 19:45 UTC
Updated:
22 Mar 2010 at 09:04 UTC
I'm using CustomCSSJS version 1.5/dev together with "Printer-friendly pages" (Printer, e-mail and PDF versions v1.10: http://drupal.org/project/print). Loading the print version doesn't include the custom css files. Many other css-files are loaded as well, so I think this might rather be a bug in CustomCSSJS than in the print module.
I would appreciate if my custom css files would be included in the print version too. Even if there is a possibility to manually attach a (single!) css file to the printed version via administration interface, this would be in opposite to the intention of this module.
Comments
Comment #1
davebv commenteddrupal_add_css includes by default in all media, I will have a deeper look into this.
Comment #2
x-lette commentedThanks in advance!
Comment #3
sirprize commentedEdit: Sorry, I misunderstood the problem. My proposed solution (which can still be seen below) does NOT work on printer-friendly pages (like I hoped it would), only while printing a normal ("non-printer-friendly") page. Perhaps I will get a chance to investigate this in the next few days, since I also would like this to work. I'm leaving the code snippet though because it could still prove useful.
Old posting
I had a similar requirement, which I fixed in a quick&dirty way. If the filename contains "print", the media is set to print. If it contains "screen", the media is set to screen. Else, the media is all.
To achieve that, I changed the code of the callback function to this:
I did not make a patch out of it because there is probably a better possibility to achieve different media types. Also, the argument list of drupal_add_css will change in D7, making an adjustment necessary.
Anyway, feel free to include or ignore this code snippet. I hope it will be useful for some :)
Comment #4
davebv commentedopen it again if necessary