Typogrify uses the wrong Drupal command to add its CSS to Drupal output:

drupal_set_html_head('<style type="text/css" media="all">@import "' . base_path() . drupal_get_path('module', 'typogrify') .'/typogrify.css' . '";</style>');

This interferes with CSS aggregation provided by Drupal 5, and prevents me from overriding Typogrify's default declarations.

Comments

Tim Gambell’s picture

Hi bangpound,

According to http://www.lullabot.com/articles/how_to_properly_add_css_files the way to add css is:

<?php
// Modules should do:
drupal_set_html_head(theme('stylesheet_import', base_path() . drupal_get_path('module', 'mymodule') .'/mymodule.css'));
?>

I can't seem to get this to work. If there is another, better way to add CSS, please let me know. In the meantime, I'll root through the docs and project pages and see if I can find some other modules that are trying to do the same thing I am.

Thanks for all your help!

Tim

Tim Gambell’s picture

Assigned: Unassigned » Tim Gambell
Tim Gambell’s picture

Looks like the correct way for a module to add css is to say:

drupal_add_css(drupal_get_path('module', 'typogrify'). '/typogrify.css', 'module', 'all', TRUE);

See http://api.drupal.org/api/HEAD/function/drupal_add_css for reference. Will implement asap.

We should allow people to turn this stylesheet off from the admin interface (but it should default to on).

Tim Gambell’s picture

Status: Active » Needs review

Patched. Let me know how this works for you. Thanks!

Tim Gambell’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)