Don't load CSS and JS on every page

Kars-T - February 6, 2009 - 11:03
Project:Storm
Version:6.x-1.20
Component:Storm.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi

one little thing about storm bugs me

<?php
function storm_init() {
 
drupal_add_js(drupal_get_path('module', 'storm') .'/storm.js', 'module', 'header', FALSE);
 
drupal_add_css(drupal_get_path('module', 'storm') .'/storm.css', 'module');
}
?>

You load those files on every page request. Please try to load them only if really needed!

Best regards,

Karsten "Kars-T" Frohwein

#1

Magnity - September 10, 2009 - 18:10
Component:Code» Storm.module

I've made a few commits on the CSS front to gradually move css from storm.css to usage specific css files (the Drupal aggregator can stick them back together on page load so that performance doesn't suffer). Also, am adding comments in the css files so that it is possible to understand where each item of css is used.

I'll be expecting any further patches on other to follow suit with comments and by putting relevant css in an appropriate file.

 
 

Drupal is a registered trademark of Dries Buytaert.