Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
А зачем это делать онлайн?
И зачем потом проверять валидацию CSS? Она в 99 случаях провалится.
for i in `find ./* -type f -name '*.css'`; do echo $i; gzip -c -9 $i > $i.gz; done;
-rw-r--r-- 1 nikitas nikitas 23328 Jun 16 16:11 azbyka.style.css
-rw-r--r-- 1 nikitas nikitas 6647 Jul 26 15:25 azbyka.style.css.gz
-rw-r--r-- 1 nikitas nikitas 26822 Mar 20 12:10 gidonline.style25.css
-rw-r--r-- 1 nikitas nikitas 5646 Jul 26 15:25 gidonline.style25.css.gz
-rw-r--r-- 1 nikitas nikitas 21678 Jul 11 2015 kartinki24_styles.css
-rw-r--r-- 1 nikitas nikitas 5262 Jul 26 15:25 kartinki24_styles.css.gz
-rw-r--r-- 1 nikitas nikitas 21678 Jul 11 2015 kartinki24_styles.css
-rw-r--r-- 1 nikitas nikitas 5262 Jul 26 20:27 kartinki24_styles.css.gz
-rw-r--r-- 1 nikitas nikitas 17471 Jul 26 20:26 kartinki24_styles.cssresizer.com.css
-rw-r--r-- 1 nikitas nikitas 4767 Jul 26 20:27 kartinki24_styles.cssresizer.com.css.gz
сервис все это уберет. а потом сжимайте gzip'ом на здоровье.
если разработчик считает решение неудачным, значит тут может быть уязвимость.
значит тут может быть уязвимость
уязвимость
Выбираем лучший онлайн-сервис по сжатию CSS
CSS может маскировать область, код которой уязвим
Т.ч. никаких коментов в продакшене!
/* Print Style Sheet
---------------------------------------- */
/* Lots still TODO here! */
/* General markup styles */
* {
padding: 0;
margin: 0;
}
В конце концов я не хакер. Но лишний повод шаловливым ручкам давать не стал бы.
Однако, если рассматривать средний результат, то с достаточно большим отрывом выделяются 2 инструмента:
1. cssresizer.com (84,13%);
nikitas@pentagon:~$ whois cssresizer.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: CSSRESIZER.COM
Registrar: REGISTRAR OF DOMAIN NAMES REG.RU LLC
Sponsoring Registrar IANA ID: 1606
Whois Server: whois.reg.com
Referral URL: http://www.reg.ru
Name Server: NS1.MCHOST.RU
Name Server: NS2.MCHOST.RU
Name Server: NS3.MCHOST.RU
Name Server: NS4.MCHOST.RU
Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Updated Date: 21-apr-2016
Creation Date: 08-apr-2016
Expiration Date: 08-apr-2017
>>> Last update of whois database: Tue, 26 Jul 2016 21:49:23 GMT <<<
For more information on Whois status codes, please visit https://icann.org/epp
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.
Domain name: cssresizer.com
Domain idn name: cssresizer.com
Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited
Registry Domain ID:
Registrar WHOIS Server: whois.reg.com
Registrar URL: https://www.reg.com/
Registrar URL: https://www.reg.ru/
Registrar URL: https://www.reg.ua/
Updated Date:
Creation Date: 2016-04-08T14:01:10Z
Registrar Registration Expiration Date: 2017-04-08
Registrar: Registrar of domain names REG.RU LLC
Registrar IANA ID: 1606
Registrar Abuse Contact Email: abuse@reg.ru
Registrar Abuse Contact Phone: +7.4955801111
Registry Registrant ID:
Registrant ID:
Registrant Name: Protection of Private Person
Registrant Street: PO box 87, REG.RU Protection Service
Registrant City: Moscow
Registrant State/Province:
Registrant Postal Code: 123007
Registrant Country: RU
Registrant Phone: +7.4955801111
Registrant Phone Ext:
Registrant Fax: +7.4955801111
Registrant Fax Ext:
Registrant Email: cssresizer.com@regprivate.ru
Admin ID:
Admin Name: Protection of Private Person
Admin Street: PO box 87, REG.RU Protection Service
Admin City: Moscow
Admin State/Province:
Admin Postal Code: 123007
Admin Country: RU
Admin Phone: +7.4955801111
Admin Phone Ext:
Admin Fax: +7.4955801111
Admin Fax Ext:
Admin Email: cssresizer.com@regprivate.ru
Tech ID:
Tech Name: Protection of Private Person
Tech Street: PO box 87, REG.RU Protection Service
Tech City: Moscow
Tech State/Province:
Tech Postal Code: 123007
Tech Country: RU
Tech Phone: +7.4955801111
Tech Phone Ext:
Tech Fax: +7.4955801111
Tech Fax Ext:
Tech Email: cssresizer.com@regprivate.ru
Name Server: ns1.mchost.ru
Name Server: ns2.mchost.ru
Name Server: ns3.mchost.ru
Name Server: ns4.mchost.ru
DNSSEC: Unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2016-07-27T00:49:39Z <<<
For more information on Whois status codes, please visit
https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en.
% By submitting a query to REG.RU Whois Service
% you agree to abide by the following terms of use:
% http://www.reg.ru/whois/servpol (in Russian)
% http://www.reg.com/whois/servpol (in English)
с достаточно большим отрывом выделяются 2 инструмента
1. cssresizer.com (84,13%);
с достаточно большим отрывом выделяются 2 инструмента
Тогда почему на многих сайтах можно наблюдать недостаточно оптимизированные стили?
Я не утверждаю что онлайн-оптимизаторы — это лучшее средство по сжатию CSS. Но тем не менее, ними тоже пользуются.
Первые 2 результата — 84,13% и 85%.
http://www.kartinki24.ru/templates/kartinki/style/styles.css, вставляем вот сюда (http://css.github.io/csso/csso.html) и получаем:Original: 21678 bytes
Compressed: 17146 bytes (79.09%)
Saving: 4532 bytes (20.91%)
Time: 214 ms
каждый оптимизатор подсчитывает размер файла «по своему»
nikitas@pentagon:~/trash$ ls -la|egrep 'kartin.*css$'
-rw-r--r-- 1 nikitas nikitas 17146 Jul 27 13:05 kartinki24_styles.ccso.css
-rw-r--r-- 1 nikitas nikitas 21678 Jul 11 2015 kartinki24_styles.css
-rw-r--r-- 1 nikitas nikitas 17471 Jul 26 20:26 kartinki24_styles.cssresizer.com.css
-rw-r--r-- 1 nikitas nikitas 21678 Jul 11 2015 kartinki24.styles.today.css
-rw-r--r-- 1 nikitas nikitas 21808 Jul 27 13:07 kartinki24_styles.utf8.css
nikitas@pentagon:~/trash$ sha1sum *|egrep 'kartin.*css$'
41ec62291de7b01504c87c19328498f81409f22f kartinki24_styles.ccso.css
9e25f5ecf615223ca1a39345bd29e811996ea627 kartinki24_styles.css
ada731e47493a48f290f6363a10ac41104059c88 kartinki24_styles.cssresizer.com.css
9e25f5ecf615223ca1a39345bd29e811996ea627 kartinki24.styles.today.css
096180e3d4d3564256f3b408450804c26f358868 kartinki24_styles.utf8.css
И снова:?
npm i gulp-cssmin -S. Ну или любой другой по вкусу.
Выбираем лучший онлайн-сервис по сжатию CSS