Posted by Alexandr Kosarev on July 26, 2008 at 9:52am
I see for way to hide js files.
For example if I have
<script type="text/javascript" src="/misc/jquery.js"></script>I want to have
<script type="text/javascript" src="/somethingrandom.js"></script>something like alias for js files
at moment I did this in my theme, just to parse $scripts, copy files to random names and replays original paths.
can I do this somehow in module without affect theme?
Comments
As I said my solution is
As I said my solution is theme based and look like this:
preg_match_all('/src="(.*)"/', $scripts, $matches);list( ,$matches) = $matches;
foreach($matches as $js_file) {
$md5_js = '/files/'.md5($js_file).'.js';
$scripts = str_replace($js_file, $base_url.$md5_js, $scripts);
if (!is_file(getcwd().$md5_js)) {
copy(getcwd().$js_file), getcwd().$md5_js);
}
}
it is theme hack but do work and js files have md5 hashes instead real names. And in my case handled with lighttpd as static content in files directory.
=-=
I'd think you can also use:
on drupal 6.x turn on js aggregation in administer -> performance
on drupal 5.x investigate the contrib js aggregation.module
I can not migrate from Drupal
I can not migrate from Drupal 5 to 6 at this time.
I already know about Javascript Aggregator, but it have several unclosed bug reports, which stop me to use it.