[TYPO3-dev] adding a javascript file so that it is merged with the other ones

Caspar Stuebs caspar at gosign.de
Thu Oct 2 10:09:10 CEST 2014


Hi Ivano.

first of all the question, why you don't like to include that js file on
every page?

If you add all js files on every page, the visitor just needs do download
the compressed js file once, and after that it comes from browser cache.

If you add additional js concatenated with standard js, the visitor
downloads the standard js on standard pages, but if he is coming to the
special pages, he will download the additional js with the standard js
together. means, he needs to download the standard js twice.

To prevent, that the standard js is downloaded twice you have to
posibilities. Either you add the additional js always, or you add it in a
seperate file.

Back to your question: I had a look to the function addJsFile(), but I did
not seen a reason, why it should not be concatenated at all, because by
default "$excludeFromConcatenation = FALSE"

May it be, that your plugin is uncached and the default js is stored in
cache and due to that it will not work? In this case I would try to make
the plugin cached and check, if it is still not being concatenated.

Kind Regards
Caspar

2014-10-01 22:26 GMT+02:00 Ivano Luberti <luberti at archicoop.it>:

> Hi, I have not explained myself it seems: I tired it but I obtain an
> additional file minified: it is not merged with the other ones
>
> Il 01/10/2014 16:45, Stephan Großberndt ha scritto:
> > So why don't you add conditions in your code to call
> > $GLOBALS['TSFE']->getPageRenderer()->addJsFile($resolved);
> > only in those cases when you need it?
> >
> > Am 26.09.2014 um 16:35 schrieb Ivano Luberti:
> >> Hi all, I'm writing an extension that renders FE pages and as part of it
> >> I'm writing a bit of javascript.
> >>
> >> I would like to add it only in pages where is needed and I would like to
> >> have it compressed together with the other javascript already compressed
> >> and merged by TYPO3.
> >>
> >> I can of course use typoscript includeJS but I should then include in
> >> every page where my plugin is installed.
> >>
> >> I have found the pageRendereHook but it adds a new link in a new file
> >>
> >> I have tried
> >>
> >> $GLOBALS['TSFE']->getPageRenderer()->addJsFile($resolved);
> >>
> >> but with same result.
> >>
> >> Any suggestion?
> >>
> >>
> >>
> >>
> >> -------- Messaggio originale --------
> >> Oggetto:     link JS
> >> Data:     Fri, 26 Sep 2014 16:06:36 +0200
> >> Mittente:     Maria Marcella Greca <greca at archicoop.it>
> >> A:     Ivano Luberti <luberti at archicoop.it>
> >>
> >>
> >>
> >> I due link trovati:
> >>
> >>
> https://github.com/JostBaron/typo3-nkhyphenation/blob/master/Classes/Hooks/PageRendererHook.php
> >>
> >>
> >>
> >>
> >> Ciao
> >> Marcella
> >>
> >>
> >>
> >>
> >
> > _______________________________________________
> > TYPO3-dev mailing list
> > TYPO3-dev at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
> >
>
> --
> ==================================================
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> web: www.archicoop.it
> ==================================================
>
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>

-- 
-- 

Gosign media. GmbH | We web ideas.
Langenfelder Damm 67 Gewerbehof | 22525 Hamburg
Telefon 040-609 40 79-0

Handelsregister AG HH HRB 112197 | Geschäftsführung Bert Gogolin
Greenpeace energy: Gosign läuft mit ehrlichem Strom und Gas.
GLS Bank: Gosign wirtschaftet mit Gewissen. 



More information about the TYPO3-dev mailing list