lochmueller / sourceopt Goto Github PK
View Code? Open in Web Editor NEWTYPO3 CMS Extension - sourceopt
Home Page: http://typo3.org/extensions/repository/view/sourceopt
License: GNU General Public License v3.0
TYPO3 CMS Extension - sourceopt
Home Page: http://typo3.org/extensions/repository/view/sourceopt
License: GNU General Public License v3.0
I was just looking at a site that had huge server side rendering times. It turned out that nearly 4 seconds were eaten by the main hook "cleanUncachedContent" handling a 130kB HTML source file. With disabling the extension parse time dropped to 150 milliseconds.
Imho, the documentation should at least contain a big fat warning that parsing is very slow for parsing "bigger" HTML content.
Hi,
I'm using TYPO3 9.5.7, sourceopt in the newest version, also tx_news in the newest version and we offer in the frontend ical files from tx_news for downloading. If I use sourceopt (tried formatHtml width config from 1-4) it removes the linebreaks from the ical files, and for this reason they are not working anymore. Is it possible to exclude some kind of special filetypes like ical?
Best regards and many thanks,
Michaela
Static TypoScript Include is added, sourceopt.enabled = 1
but no minifying in the frontend?
Is it a Bug?
TYPO3 11.5.16
sourceopt 4.0.5
Not all spaces between HTML tags are removed, some are left over.
Hi! This message keeps appearing in TYPO3 error log:
Core: Error handler (FE): PHP Warning: preg_match(): Empty regular expression in /var/www/clients/client1/web1/dev32aug/typo3conf/ext/sourceopt/Classes/Manipulation/RemoveComments.php line 70
Also - comment "This website is powered by TYPO3 - inspiring people to share!" isn't removed.
I'm using TYPO3 v7.6.22 and Sourceopt 1.0.0
Thank you.
there is a indentation issue with inline SVG
<path></path>
<path></path>
<path/>
<path/>
<path></path>
<g>
<path></path>
</g> </svg>
<path/><g>
<path/></g> </svg>
sourceopt.formatHtml = 4
sourceopt.formatHtml.tabSize = 2
v4.0 changelog: "Drop PHP 7.3 support"
composer.json (master): "php": "^7.3||^7.4||^8.0",
Which one is correct? Can I still use it on PHP 7.3 or not?
With sourceopt running - json Data gets invalid.
Hello,
since Version 4 i get problems with xml or json pages (special typeNums), they are not getting rendered.
I tried to deactivate sourceopt in typoscript for this pagetypes, but still they are not getting rendered.
Any ideas what I need to do?
Best regards and thank you,
Michaela
If i enable svgstore (svgstore.enabled = 1
) this exception pops up:
PHP Runtime Deprecation Notice: Automatic conversion of false to array is deprecated in /Users/***/typo3conf/ext/sourceopt/Classes/Service/SvgStoreService.php line 158
TYPO3 11.5.16
sourceopt 4.0.5
When whitespaces get removed from a text, there's still one space before and one space after the text left:
<a> Label </a>
Expected behaviour: All whitespaces are removed around the text.
EXT:sourceopt v2.0.0
TYPO3 v10.4.4
problems with the use of sourceopt under
Typo3 11.5.16
PHP 8.1
sourceopt: 4.0.5
Errors:
PHP Warning: Undefined array key "svgstore." in /app/web/typo3conf/ext/sourceopt/Classes/Middleware/SvgStoreMiddleware.php line 30
PHP Warning: Undefined array key "formatHtml." in /app/web/typo3conf/ext/sourceopt/Classes/Service/CleanHtmlService.php line 72
Fix: check isset before use
Hi there,
Is a new version for TYPO3 9.5 soon available in TER?
Thanks!!
Hi,
did you know with HTML5, a lot of tags are optional. Take a look at Google Style Guide and the HTML5 specification. With that technique we are able to save a lot of bytes.
It would be nice if sourceopt can handle this.
kind regards,
André
The picture html construct allows the browser to select the most suitable picture based on the device specifications (e.g. orientation, resolution, etc.). It does require a single img element within it to properly function and to allow for backward compatibility as well (e.g. Internet Explorer and other trash)
However when the new svgstore feature replaces said <img>
with a <svg>
, it essentially breaks the
More on <picture>
: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture
Language label missing for LLL:EXT:sourceopt/Resources/Private/Language/locallang.xlf:sourceopt.headerComment
Hi,
please push a new version to Packagist & TER with all new changes.
the changes in 94b7c32 caused my frontend break.
I just got an empty response and no error -.-
/(?:<a)?\sid="c[0-9]+"(?:><\/a>)?/g
If I include sourceopt in my cart test installations the 'addtocart' button does not function anymore
As far as see, you have skipped support for PHP 7.3 in version 4.0.3 in composer.json, but not in ext_emconf.php.
I have a composer installation using PHP 7.3 and had to downgrade to version 4.0.1 now due to a bug in 4.0.2.
I think PHP 7.3 should be supported as it is the minimum required version for TYPO3 10 LTS.
After updating of sourceopt to version to 4.0.2 i got this error (and WEB Site is broken):
Uncaught TYPO3 Exception: Return value of HTML\Sourceopt\Service\SvgStoreService::addFileToSpriteArr() must be of the type array or null, bool returned | TypeError thrown in file /html/typo3/typo3conf/ext/sourceopt/Classes/Service/SvgStoreService.php in line 132. ...
The extension can't currently be required with composer, since 1218f59 is not part of any tag. Could you release a patch version so we can switch from dev-master to a tag again?
strange behavior - trying sourceopt with 7.6.8. after installation sourcopt is packing the html correct with config 4.
but disableing it within constants or direct in files (constants.txt or setup.txt) isn't working.
I was wondering, what this whitespace is good for? If the user wants the output to be in one line and "super optimizied", this whitespace leeds to "> <" everywhere.
Does the code really needs it here? Maybe we can add a config.notEvenOneWhitespace to the constants to allow the user to change between whitespaces between tags and no whitespaces.
I used this config:
sourceopt.enabled = 1
sourceopt.removeGenerator = 1
sourceopt.removeBlurScript = 1
sourceopt.removeComments = 1
sourceopt.formatHtml = 1
Hi,
today I have updated to the latest version from the TYPO3 repository in EM. I saw the change, that Classes/User/PageRendererHook.php was removed and wondered, why there is no new Hook to replace the old one.
To get sure, I redownload the *.t3x file from http://typo3.org/extensions/repository/view/sourceopt and installed it.
Again, no hook found in the folders and the extension doesn't work in the system.
I looked at this github repository and saw: sourceopt/Classes/User/FrontendHook.php.
I downloaded and installed the latest master from github and now the extension work as expected.
It may be true that that this class is missing in the latest release in the TYPO3 repository?
Best regards
Its not possible to change the value of "dropEmptySpaceChar".
Hey there and thanks for your great extension.
When will you upload the newest version for TYPO3 9.5.x to the TER?
Thanks in advance :-)
Hello,
For some reason some pages returns this error:
Oops, an error occurred!
PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/web/typo3conf/ext/sourceopt/Classes/Service/CleanHtmlService.php line 186
It looks like preg_split
(here) split html into it's elements doesn't returns array and it returns FALSE
. This issue occures only on some pages.
Multi-line content in the value
-attribute of input
-tags is converted to single line.
E.g. powermail uses hidden input fields to pass along multi-line content of textarea-inputs.
Is it possible to keep line-breaks untouched in the value
-attribute of input
-tags?
In the constraints in ext_emconf.php
the PHP version is limited to 7.2 only. Could you please increase the version constraint?
'sql_mode=only_full_group_by' is a default setting in the latest versions of MariaDB and MySQL.
The query in SvgFileRepository.php doesn't meet this requirement. Easiest way to fix it without rewriting the query is adding the select fields to the group-by:
->groupBy('sys_file.uid', 'sys_file.storage', 'sys_file.identifier', 'sys_file.sha1')
ext_localconf contains:
if (TYPO3_MODE == 'FE') {
... register main parsing hook
}
This "if" should vanish and the hook should be registerde always, otherwise this hook registration can not be seen in the BE "Configuration" module.
Took me some time to find this going-amok hook when I did a performance analysis ...
I can not reproduce, but sometimes I have this error in my administrationprotocol.
Core: Error handler (FE): PHP Warning: preg_match(): Empty regular expression in /var/www/httpdocs/typo3conf/ext/sourceopt/Classes/Service/CleanHtmlService.php line 525
Should not be possible due to (!empty), but...
Hey,
are there any plans to do a v10 LTS compatible release (= tag)?
Is seems sourceopt cannot deal with svg tags (that is also path, group, etc) or maybe even with self-closing tags (path is always self-closing, e.g.).
When using formatHtml = 4
, the source keeps indenting like this:
<path .../>
<path .../>
<path .../>
But is should be like this:
<path .../>
<path .../>
<path .../>
Even though formatHtml=4 seems like sugar on the cake and might everything but not recommended for real world scenarios, it would be nice to have it working properly, sind well-formated HTML is also a form of debugging. Things like double p-tags (which happens, if a f:format.html is wrapped inside a p-tag ... well, yes, it happens ...) would be easily recognizable.
Also, source formatting is a very weak topic in TYPO3 and only 2 ext (this one and "min") provide such a feature. And since TYPO3 is mainly a configuration monster, we need way more configuration than currently available!!! :-)
(seriously: Why not provide a "tag selector", so the user can define, what should be treated as block level element and what not - very much like phpstorm does)
Thank you!
Bug Report
Current Behavior
PHP version constraint in ext_emconf.php doesn't match version constraint in composer.json
ext_emconf.php: 7.4.0-8.0.99
composer.json: ^7.4||^8.0
The later constaint (composer.json) allows installation under PHP 8.0 and 8.1 (up all version < 9). The constraint in ext_emconf.php only up to 8.0.99.
Expected behavior/output
Both constaints should be the same.
Possible Solution
Change contraint in ext_emconf.php to '7.4.0-8.99.99' or at least to '7.4.0-8.1.99'
As soon as Sourceopt is activated, no sitemap of the seo extension (seo) and also no RSS feed of the blog extension (blog) will be generated. Tested in TYPO3 .10.4.21, Sourceopt 4.0.1
With 4.0 I get this on every page (cleared all caches):
substr() expects parameter 1 to be string, null given | TypeError thrown in file sourceopt/Classes/Service/CleanHtmlService.php in line 220
On this position in code: It accesses on first run ($x=0
) an invalid offset $htmlArray[-1]
for ($x = 0; $x < \count($htmlArray); ++$x) {
// check if the element should stand in a new line
$newline = false;
if ('<?xml' == substr($htmlArray[$x - 1], 0, 5)) {
(which is a consequence of strict_types=1
)
Get:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- lochmueller/sourceopt dev-master requires typo3/cms-core ~6.2.0||~7.6.0||~8.4.0||~8.6.0||dev-master -> no matching package found.
- lochmueller/sourceopt dev-master requires typo3/cms-core ~6.2.0||~7.6.0||~8.4.0||~8.6.0||dev-master -> no matching package found.
- Installation request for lochmueller/sourceopt dev-master as 0.9.3 -> satisfiable by lochmueller/sourceopt[dev-master].
I'm using:
TYPO3 v9.5.13
PHP v7.4.1
sourceopt v2.0.0
My typoscript contains this:
config {
##########################################
### Generator entfernen
##########################################
sourceopt{
enabled = 1
removeBlurScript = 1
removeGenerator = 1
removeComments = 1
formatHtml = 1
dropEmptySpaceChar = 1
}
}
But when I render the frontend it just keeps the part <meta name="generator" content="TYPO3 CMS" />
I don't know if this version if going to TER, but there is a version 2.0, it just has different settings in the config like the one mentioned in the title.
Will that be changed?
TYPO3 by default does only a very simplistic javascript / css compression when activiating the corresponding compressJS / compressCSS options.
It would be nice to optionally add some existing third party libraries for this and use:
$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler']
and
$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler']
Warning: If this one is overriden, it might also be necessary to fix some "paths" in the CSS files (if it is excluded from concatination), see method \TYPO3\CMS\Core\Resource\ResourceCompressor::compressCssFile
especially:
if (!file_exists((PATH_site . $targetFile)) || $this->createGzipped && !file_exists((PATH_site . $targetFile . '.gzip'))) {
$contents = $this->compressCssString(GeneralUtility::getUrl($filenameAbsolute));
if (strpos($filename, $this->targetDirectory) === false) {
$contents = $this->cssFixRelativeUrlPaths($contents, PathUtility::dirname($filename) . '/');
}
$this->writeFileAndCompressed($targetFile, $contents);
}
Of course, the best option is probably to use a corresponding FE workflow but it would still be nice to have the option to compress those files without building a FE workflow.
composer why-not typo3/cms:8.7.0
typo3-ter/sourceopt 0.9.3 requires typo3/cms-core (>= 6.2.0, <= 7.99.99)
I would like to install the extension version 2.0.0 (for TYPO3 9.5) using Composer. But here https://packagist.org/packages/lochmueller/sourceopt only the version 1.0.0 is present.
Could you update the packagist?
Thanks
Klaus
Hi,
if I have something like this:
<div>foo
bar</div>
With no whitespace between "foo" and "bar" except one new line. Then that whitespace gets completely lost and in the end the display will be "foobar" instead.
Most likely there will be a whitespace somewhere after or before a line break, so it will very likely not be an issue but it should still be fixed.
Tried with formatHtml = 1 and formatHtml = 4
Hi,
is a new version for TYPO3 9.5 planned?
I see the master brach is compatible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.