January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 16 January 2015 at 20:40:29 UTC, Andrei Alexandrescu wrote:
> On 1/16/15 10:40 AM, H. S. Teoh via Digitalmars-d wrote:
>> On Fri, Jan 16, 2015 at 10:37:38AM -0800, Andrei Alexandrescu via Digitalmars-d wrote:
>>> On 1/16/15 9:58 AM, Vladimir Panteleev wrote:
>>> [snip]
>>>
>>> Just made css minification opt-in. -- Andrei
>>
>> Thanks!!
>
> Glad it works for you. Vladimir, is opt-in okay with you as a first step toward a more secure solution? -- Andrei
I do not build the documentation often, so my post was an attempt at advice from experience rather than an objection based on personal motives. Generally, and as I mentioned at the top of my post, I think opt-in is acceptable, as the default no longer has risks of security or unexpected failure.
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On 1/16/15 12:27 PM, Vladimir Panteleev wrote:
> On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:
>> What would be a trustworty offline CSS minifier?
>
> http://yui.github.io/yuicompressor/
>
> Its only dependency is Java.
>
> Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
$ java
No Java runtime present, requesting install.
$ _
Andrei
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 1/16/15 12:37 PM, Steven Schveighoffer wrote:
> On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:
>> I just added
>> https://github.com/D-Programming-Language/dlang.org/pull/770, which
>> generates minified css files. This is because in the near future css
>> files will become heftier (more documentation comments, more detailed
>> styles etc).
>>
>> The disadvantage is that now one needs to be online to generate
>> documentation. Thoughts?
>
> Almost all browsers support gzip transfer of files. You'd get much
> better mileage with just gzipping the file.
>
> -Steve
That's part of the protocol, right? We should be doing that anyway. Anyhow, the css is really hot and comments just add to it, compressed or not. -- Andrei
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:
> On 1/16/15 12:27 PM, Vladimir Panteleev wrote:
>> On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:
>>> What would be a trustworty offline CSS minifier?
>>
>> http://yui.github.io/yuicompressor/
>>
>> Its only dependency is Java.
>>
>> Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
>
> $ java
> No Java runtime present, requesting install.
> $ _
No idea what that means. Google says it's a Mac problem.
I am neither a Java nor Mac person, sorry.
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On 1/16/15 12:56 PM, Vladimir Panteleev wrote:
> On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:
>> On 1/16/15 12:27 PM, Vladimir Panteleev wrote:
>>> On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:
>>>> What would be a trustworty offline CSS minifier?
>>>
>>> http://yui.github.io/yuicompressor/
>>>
>>> Its only dependency is Java.
>>>
>>> Usage: java -jar yuicompressor-*.jar --type css < input.css > output.css
>>
>> $ java
>> No Java runtime present, requesting install.
>> $ _
>
> No idea what that means. Google says it's a Mac problem.
>
> I am neither a Java nor Mac person, sorry.
That's why online services rok. Anyone knows of a secure css minimizing service? -- Andrei
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 16 January 2015 at 21:04:58 UTC, Andrei Alexandrescu wrote:
> On 1/16/15 12:56 PM, Vladimir Panteleev wrote:
>> On Friday, 16 January 2015 at 20:51:34 UTC, Andrei Alexandrescu wrote:
>>> On 1/16/15 12:27 PM, Vladimir Panteleev wrote:
>>>> On Friday, 16 January 2015 at 18:16:55 UTC, Andrei Alexandrescu wrote:
>>>>> What would be a trustworty offline CSS minifier?
>>>>
>>>> http://yui.github.io/yuicompressor/
>>>>
>>>> Its only dependency is Java.
>>>>
>>>> Usage: java -jar yuicompressor-*.jar --type css < input.css
>>>> > output.css
>>>
>>> $ java
>>> No Java runtime present, requesting install.
>>> $ _
>>
>> No idea what that means. Google says it's a Mac problem.
>>
>> I am neither a Java nor Mac person, sorry.
>
> That's why online services rok. Anyone knows of a secure css minimizing service? -- Andrei
I could put one up in a few minutes. But I think it'd be better if it was on dlang.org's servers.
Now... does the server have Java installed? ;)
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 1/16/15 3:53 PM, Andrei Alexandrescu wrote:
> On 1/16/15 12:37 PM, Steven Schveighoffer wrote:
>> On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:
>>> I just added
>>> https://github.com/D-Programming-Language/dlang.org/pull/770, which
>>> generates minified css files. This is because in the near future css
>>> files will become heftier (more documentation comments, more detailed
>>> styles etc).
>>>
>>> The disadvantage is that now one needs to be online to generate
>>> documentation. Thoughts?
>>
>> Almost all browsers support gzip transfer of files. You'd get much
>> better mileage with just gzipping the file.
>>
>> -Steve
>
> That's part of the protocol, right? We should be doing that anyway.
> Anyhow, the css is really hot and comments just add to it, compressed or
> not. -- Andrei
I think this is way over-optimization.
If the system already sends gzipped, I don't think any kind of minification is going to improve enough to the point of justifying all this.
(Dons Walter hat): have you profiled to see how much it saves?
-Steve
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 16 January 2015 at 21:04:58 UTC, Andrei Alexandrescu wrote: > That's why online services rok. Anyone knows of a secure css minimizing service? -- Andrei Minification in general is of dubious value, but doubly so with css, it barely makes a difference compared to gzip and client side caching. If comments are a problem, just write a little regex thingy to strip them out. You could do the same to leading and trailing whitespace on a line, though that's really negligible too. Or, you could use something like my css macro expand which transforms css in a useful way and strips out comments in the process. .foo { .nesting-supported-with-css-expand { } } http://code.dlang.org/packages/cssexpand |
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 1/16/15 1:13 PM, Steven Schveighoffer wrote:
> On 1/16/15 3:53 PM, Andrei Alexandrescu wrote:
>> On 1/16/15 12:37 PM, Steven Schveighoffer wrote:
>>> On 1/16/15 12:40 PM, Andrei Alexandrescu wrote:
>>>> I just added
>>>> https://github.com/D-Programming-Language/dlang.org/pull/770, which
>>>> generates minified css files. This is because in the near future css
>>>> files will become heftier (more documentation comments, more detailed
>>>> styles etc).
>>>>
>>>> The disadvantage is that now one needs to be online to generate
>>>> documentation. Thoughts?
>>>
>>> Almost all browsers support gzip transfer of files. You'd get much
>>> better mileage with just gzipping the file.
>>>
>>> -Steve
>>
>> That's part of the protocol, right? We should be doing that anyway.
>> Anyhow, the css is really hot and comments just add to it, compressed or
>> not. -- Andrei
>
> I think this is way over-optimization.
>
> If the system already sends gzipped, I don't think any kind of
> minification is going to improve enough to the point of justifying all
> this.
>
> (Dons Walter hat): have you profiled to see how much it saves?
Well good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico. Loading css accounts for 12.78% of all dlang.org hits and 5.73% of all dlang.org bytes transferred. I'd say improvements would be measurable.
BTW are there ways to compress favicon.ico better? It's #1 with 10.28% of all hits and 16.27% of all bytes transferred.
Andrei
|
January 16, 2015 Re: css minification | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 16 January 2015 at 21:26:04 UTC, Andrei Alexandrescu wrote: > Well good point. As of January two of the css files are in the top 3 most trafficked files off of dlang.org, second only to favicon.ico. That's probably because HTTP caching is not configured. Ideally, you'd put the file's modification time in its path, e.g.: <link rel="stylesheet" type="text/css" href="css/1421443851/style.css" /> css/*/style.css would point to the same style.css (via internal, not HTTP redirect). Then, css/* can be cached forever, as the URL of the file would change when the file changes. This is what DFeed does, but I'm not sure if this is feasible with just DDoc and makefiles, though. |
Copyright © 1999-2021 by the D Language Foundation