Xóa CSS core của Drupal 7

Events happening in the community are now at Drupal community events on www.drupal.org.
freenotes's picture

@import url("http://localhost/ntsieu/modules/system/system.base.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/system/system.menus.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/system/system.messages.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/system/system.theme.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/comment/comment.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/field/theme/field.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/node/node.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/search/search.css?lsw5uw");
@import url("http://localhost/ntsieu/modules/user/user.css?lsw5uw");

Em muốn xóa tất cả các CSS trên nhưng ko biết pải dùng cách nào để xóa được cả. :( dùng hook_css_alter nhưng ko có tác dụng. Help me! thanks

Comments

Trời đất mấy cái đó có làm gì

Demonthorn's picture

Trời đất mấy cái đó có làm gì bạn đâu mà phải xóa. Cần theming thì cứ overide nó đi là xong mà?
Người ta đã khuyến cáo không sửa core drupal, ai lại đi làm vậy :|

Xóa bình thường

ChoNguyenVan's picture

hook_css_alter xóa được đó bạn.
Nếu bạn đã code chuẩn rồi mà nó vẫn không xóa thì bạn vào lại link admin/modules để Drupal cập nhật lại hook là xóa ok.

Code tham khảo:

<?php
// $Id: dev_insert_table.module, version 1.0 12/10/2011 00:30:00 Metalscorpion Exp $

/**
* Implementation of hook_css_alter
*/
function dev_insert_table_css_alter(&$css) {
 
   
// Remove the css files.
   
unset($css[drupal_get_path('module', 'system') . '/system.base.css']);   
    unset(
$css[drupal_get_path('module', 'comment') . '/comment.css']);
}
?>

Free Notes

freenotes's picture

@MetalScorpion: Mình đã làm được rồi bạn ạ. Cảm ơn bạn rất nhiều.
@DemonThorn: Mình ko sửa core, trong file template.php bạn thêm function hook_css_alter để remove các css base đi, khi viết css sẽ đơn giản hơn nhiều, không bị dính các css có sẵn.

Nguyên tắc của css là từ trên xuống, nó sẽ nhận các css ở dưới cùng. khi thêm css trong info nó sẽ nằm dưới các css mặc định. Nhưng khi load trang, nó cũng sẽ load các css mặc định đó. sẽ ảnh hưởng tới tốc độ trang.

Y: Free.Notes
F: tuansieu
T: tuansieu
E: free.notes@yahoo.com
W: freenotes.us - drupalvn.org
P: 0936 111 039

à à tức là không gọi nó trong

Demonthorn's picture

à à tức là không gọi nó trong header nữa, tưởng bạn muốn xóa nó khỏi source luôn ^^ sr hiểu nhầm

Kiếm backlink nào:
Chuyên trang công nghệ thông tin