<![CDATA[ Re: Has anyone successfully minified all HTML output? - My Forums]]> https://forums.modx.com/thread/?thread=88445 <![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562677
In /core/model/modx/modresponse.class.php in the outputContent method I've added this regex directly above
'echo $this->modx->resource->_output;' (line 175ish)

		   
$this->modx->resource->_output = preg_replace(
	array(
		'/ {2,}/',
		'/<!--.*?-->|\t|(?:\r?\n[ \t]*)+/s'
	),
	array(
		' ',
		''
	),
	$this->modx->resource->_output
);


It's bad practice to do this for sure, but it works really well for a couple of websites I manage.
]]>
Towila Nov 13, 2018, 11:29 AM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562677
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562352 ]]> nuan88 Oct 27, 2018, 10:14 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562352 <![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562349 Or you can use these tools
https://qawithexperts.com/tools/minify-js-online
https://qawithexperts.com/tools/minify-css-online
https://qawithexperts.com/tools/minify-html-online
Thanks
]]>
sunny_jk Oct 27, 2018, 05:11 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-562349
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-542178 Quote from: dinocorn at Apr 17, 2016, 06:14 AM
I wound up using StatCache. I forked it and made a PR that adds an option to minify the HTML when written to the filesystem.
https://github.com/opengeek/statcache/pull/27

And I got my perfect page speed score!!!

I made a simple HTML2Minify plugin, take a look here

https://github.com/play2web/HTML2Minify]]>
miomir.dancevic Jun 04, 2016, 07:19 AM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-542178
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-540565 https://github.com/opengeek/statcache/pull/27

And I got my perfect page speed score!!!]]>
dinocorn Apr 17, 2016, 01:14 AM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output?page=2#dis-post-540565
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538547 I used blocks so that I could get a fairly working preview offline

        if slider == "yes"
          [[+slider:is=`yes`:then=`
          .bigTitleBG.shiftMe
            .container 
               block sliderM
          `]]
        if h2Content == "yes"
          [[+slider:is=`pagetitle`:then=`
          .bigTitleBG
            .intros
              [[+neighbourNav]]


And since, as you know, in Jade, you don't need to close HTML tags, high speeds can be reached.
It was fun. And connected to SublimeText, it was cool.]]>
donshakespeare Feb 19, 2016, 03:21 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538547
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538546 Quote from: donshakespeare at Feb 19, 2016, 08:34 PM
I use Jade to prepare my MODX template - its output is totally minified.

Then [[*content:strip]] and then I bag all other outputs into a snippet/chunk - and strp that too.
Final view source on browser is in on one line.

Any tips on resources on how to use Jade to prepare MODX templates? I'm so close to 100/100 speed score!]]>
dinocorn Feb 19, 2016, 02:39 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538546
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538545
Then [[*content:strip]] and then I bag all other outputs into a snippet/chunk - and strp that too.
Final view source on browser is in on one line.]]>
donshakespeare Feb 19, 2016, 02:34 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538545
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538540
Maybe there is a better way to do it by tapping into plugin events somehow.]]>
dinocorn Feb 19, 2016, 12:47 PM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538540
<![CDATA[Re: Re: Has anyone successfully minified all HTML output?]]> https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538534 HtmlInLine
I use it often and it works very well

https://github.com/extras-evolution/HtmlInLine/]]>
banzai Feb 19, 2016, 09:48 AM https://forums.modx.com/thread/88445/has-anyone-successfully-minified-all-html-output#dis-post-538534