? ?
Referenced as Pull Request for: # 6383 # 6391
avatar nonumber
nonumber
10 Mar 2015

Can we have the build/generatecss.php also create .min.css files?
That way we can use minified css files instead.
I think the YUI Compressor would be a good choice...

avatar nonumber nonumber - open - 10 Mar 2015
avatar joomla-cms-bot joomla-cms-bot - change - 10 Mar 2015
Labels Added: ?
avatar nonumber
nonumber - comment - 10 Mar 2015

Also it would be good to keep the comment tags from the less files in the (non-minified) css files.

avatar brianteeman brianteeman - change - 10 Mar 2015
Labels Added: ?
avatar mbabker
mbabker - comment - 10 Mar 2015

So to keep comments, we just need to call $less->setPreserveComments(true); in the parser.

As for compressed files, I've been using the lessc_formatter_compressed format class that ships with lessc as of late (no idea how much it actually compresses).

All in all, I wouldn't argue against it.

avatar nonumber
nonumber - comment - 10 Mar 2015

Great. What can I do to make this happen?

avatar mbabker
mbabker - comment - 10 Mar 2015

Send the PR? :smiley:

avatar dgt41
dgt41 - comment - 10 Mar 2015

I wish we could also implement a versioning system for css. A version no e.g. v1 is added in the template params and increased by one in every alteration (each time generatecss is run), and that will be injected in the filename of the css
This little change will deprecate the addStyleSheetVersion() function, which most of the times is not working as expected, the message clean your browsers cache is common for the admin area!

avatar zero-24 zero-24 - change - 10 Mar 2015
Category Repository
avatar nonumber
nonumber - comment - 10 Mar 2015

You can with addStyleSheetVersion.
Just add whatever you want after the '?" as the second variable.

addStyleSheetVersion($url, $version = null, $type = "text/css", $media = null, $attribs = array())
avatar dgt41
dgt41 - comment - 10 Mar 2015

Actually I was thinking something like this:
generatecss.php

        require_once dirname(__DIR__) . '/libraries/cms/version/version.php';
        $jversion = new JVersion;
        $version  = $jversion->RELEASE;

        $templates = array(
            JPATH_ADMINISTRATOR . '/templates/isis/less/template.less' => JPATH_ADMINISTRATOR . '/templates/isis/css/template_v' . $version . '.css',
            JPATH_ADMINISTRATOR . '/templates/isis/less/template-rtl.less' => JPATH_ADMINISTRATOR . '/templates/isis/css/template-rtl_v' . $version . '.css',

And in the index.php of each template:

$jversion        = new JVersion;
$version         = $jversion->RELEASE;

// Add Stylesheets
$doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template' . ($this->direction == 'rtl' ? '-rtl' : '') . '_v' . $version . '.css');

So instead of template.css?124235345 we’ll have template_v3.4.css which is way better from my perspective

avatar mbabker
mbabker - comment - 10 Mar 2015

That wouldn't be very efficient from a packaging aspect, we would have to delete the old files on each release then. Using query strings allows us to use the same base file name then using the addStyleSheetVersion method, you could specify a custom version.

avatar dgt41
dgt41 - comment - 10 Mar 2015

But this addStyleSheetVersion doesn’t really work if we have to tell people to clear the browser cache every now and then!
Yes there should be a few removals on the packaging script but I think this worth it (or I am totally wrong here

avatar mbabker
mbabker - comment - 10 Mar 2015

Personal opinion, I don't think it's right to put file (or system) version numbers in file names unless it's describing a download package or you're pulling from a CDN. So my suggestion wouldn't be to go your route where the version number is exposed via the file name but rather debug any issues in addStyleSheetVersion (and addScriptVersion) if there are any that need addressing and use that piece of the API as intended.

avatar nonumber
nonumber - comment - 10 Mar 2015

The addStyleSheetVersion should be enough to not have people clear the browser cache.
If that isn't working for you, then something else is wrong.

avatar brianteeman
brianteeman - comment - 10 Mar 2015

Exactly. ?6544 should be enough

Adding the version number to the filename is bad in many ways
On 10 Mar 2015 16:51, "Peter van Westen" notifications@github.com wrote:

The addStyleSheetVersion should be enough to not have people clear the
browser cache.
If that isn't working for you, then something else is wrong.


Reply to this email directly or view it on GitHub
#6378 (comment).

avatar dgt41
dgt41 - comment - 10 Mar 2015

Please check #6383

avatar nonumber
nonumber - comment - 11 Mar 2015

I was also doing this and started with this PR: #6391

avatar zero-24 zero-24 - change - 12 Mar 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-03-12 23:24:10
Closed_By zero-24
avatar joomla-cms-bot joomla-cms-bot - close - 12 Mar 2015
avatar joomla-cms-bot
joomla-cms-bot - comment - 12 Mar 2015

Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/6378

avatar joomla-cms-bot joomla-cms-bot - close - 12 Mar 2015
avatar zero-24
zero-24 - comment - 12 Mar 2015

Closing here as we have two PRs for this issue. Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6378.

Add a Comment

Login with GitHub to post a comment