Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When the need for asset management araised in 2010 there was no alternatives on the market (the https://github.com/kriswallsmith/assetic was developed in 2011) and we had to write something ourselves. This unfortunately forced us to copy/paste specific (latest at the time) versions of "JsMin" and "CssMin" into In-Portal. As a result we're not receiving any updates/fixes from these libraries as well.

Fixtures

Status
colourGreen
titlevalid

Code Block
languagecss
titleNon-Minified File
linenumberstrue
@media screen and (min-width: 480px) and (max-width: 639px) {
	body {
		background: #000 url(/themes/advanced/img/header-bg.png) no-repeat top left;
	}
}

@media screen and (max-width: 640px) {
	body {
		background: #000 url(/themes/advanced/img/header-bg.png) no-repeat top left;
	}
} 

Status
colourRed
titleinvalid

Code Block
languagecss
titleCompressed File Using YUICompressor
linenumberstrue
@media screen and(min-width:480px) and(max-width:639px){body{background:#000 url(/themes/advanced/img/header-bg.png) no-repeat top left;}}@media screen and(max-width:640px){body{background:#000 url(/themes/advanced/img/header-bg.png) no-repeat top left;}}

Status
colourGreen
titlevalid

Code Block
languagecss
titleMinified using PHPMin
linenumberstrue
@media screen and (min-width: 480px) and (max-width: 639px){body{background:#000 url(/themes/advanced/img/header-bg.png) no-repeat top left}}@media screen and (max-width: 640px){body{background:#000 url(/themes/advanced/img/header-bg.png) no-repeat top left}}

Turns out that YUICompressor is awfully bad in compression of CSS, that uses media queries, because it transforms "and (" into "and(" and that immediately makes CSS non-working.

Solution

  1. use https://github.com/kriswallsmith/assetic library for asset file creation (internals of "m_Compress" tag)
  2. use JsMin and CssMin from Composer
  3. deprecate "JsMinifyHelper" and "CssMinifyHelper" classes in favor of "MinifyHelper::compressString" method
  4. store compiled assets in "/system/cache/assets/" folder instead of "/system/cache/" folder

...