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...
Labels |
Added:
?
|
Labels |
Added:
?
|
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.
Great. What can I do to make this happen?
Send the PR?
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!
Category | ⇒ | Repository |
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())
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
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.
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
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.
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.
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).
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-12 23:24:10 |
Closed_By | ⇒ | zero-24 |
Set to "closed" on behalf of @zero-24 by The JTracker Application at issues.joomla.org/joomla-cms/6378
Closing here as we have two PRs for this issue. Thanks!
Also it would be good to keep the comment tags from the less files in the (non-minified) css files.