Opened 7 years ago

Closed 4 years ago

#15522 closed enhancement (patchwelcome)

Build: Improved support for CSS minification

Reported by: Paul Christopher Owned by: Rawld Gill
Priority: low Milestone: 1.13
Component: BuildSystem Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

1) CSS compression seems not to be ideal? Compressing an already compressed claro.css file with the YUI Compressor reduces the size of the file by 6KB, see attached files.

2) At the moment CSS compression seems to be supported only for theme files? However my app/ website consist of several other CSS files which are normally included in the header of the html pages like so:

<!DOCTYPE html>
<html lang="de">
<head>
<link rel="stylesheet" href="/Content/normalize.css">
<link rel="stylesheet" href="/Scripts/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="/Content/site.css">
...
</head>
<body>
...
</body>
</html>

I would be cool, if I could transform the other CSS files (site.css, normalize.css) by running a build, too, i.e. it needs an option in the build profile to add these files so as to just copy and compress them. IMHO running a build should transform the "whole" debug-tree to a release-tree which includes compressing/ merging of other CSS files (other non dojo JS files??), too.

Maybe this tool needs not to be written by the Dojo community, but an existing CSS minifier (jar file, node.js based minifier) could be added to the util folder?

Attachments (4)

claro.css (111.5 KB) - added by Paul Christopher 7 years ago.
claro_YUIcompressed.css (105.6 KB) - added by Paul Christopher 7 years ago.
[BR]claro.css (112.4 KB) - added by Paul Christopher 7 years ago.
claro.css with line-breaks for a better diff experience
[BR]claro_YUIcompressed.css (106.6 KB) - added by Paul Christopher 7 years ago.
claro_YUIcompressed.css with line-breaks for a better diff experience

Download all attachments as: .zip

Change History (11)

Changed 7 years ago by Paul Christopher

Attachment: claro.css added

Changed 7 years ago by Paul Christopher

Attachment: claro_YUIcompressed.css added

Changed 7 years ago by Paul Christopher

Attachment: [BR]claro.css added

claro.css with line-breaks for a better diff experience

Changed 7 years ago by Paul Christopher

Attachment: [BR]claro_YUIcompressed.css added

claro_YUIcompressed.css with line-breaks for a better diff experience

comment:1 Changed 7 years ago by Paul Christopher

When compressing CSS files, Google's Closure-Stylesheets seems to have problems with dijit.css's IE hacks like #zoom and top: expression(eval((document.documentElement||document.body).scrollTop));. Hence Closure-Stylesheets seems not to be usable at the moment for us. Thus added a bug report, see http://code.google.com/p/closure-stylesheets/issues/detail?id=21.

Last edited 7 years ago by bill (previous) (diff)

comment:2 Changed 7 years ago by Rawld Gill

Milestone: tbd2.0
Priority: undecidedlow
Resolution: fixed
Status: newclosed

I agree the CSS compressor is pretty unintelligent. We'll look at this for 2.0.

comment:3 Changed 7 years ago by bill

Did you really mean to close this as fixed?

comment:4 Changed 7 years ago by Paul Christopher

But why do you close the ticket then and set the resolution to "fixed"? Wouldn't it be a better reminder to leave it open? Actually there is no fix for this at the moment..

Moreover: Not only could compression ratios be optimized, css compression should also be available for non dojo css files. That's the point I wanted to make.

comment:5 Changed 7 years ago by bill

Resolution: fixed
Status: closedreopened

comment:6 in reply to:  3 Changed 7 years ago by Rawld Gill

Status: reopenedassigned

Replying to bill:

Did you really mean to close this as fixed?

Yeah, sorry, that was a mistake...meant to push it off to 2.0.

comment:7 Changed 4 years ago by dylan

Milestone: 2.01.12
Resolution: patchwelcome
Status: assignedclosed

Given the state of CSS preprocessors today, I think it's better to rely on the preprocessor than to add this to a future change in the build system.

That said, if someone wants to create a pull request for the current Dojo 1.x build system, we would consider it.

Note: See TracTickets for help on using tickets.