Comments (6)
Можно, но страшно. :)
Дык а как именно не группируется?
from csso.
Хотя уже вижу. Вы про .test { padding: 1px; padding-top: 2px } => .test { padding: 2px 1px 1px }?
Update: дык так и надо. Уточните, пожалуйста, ибо не понять.
from csso.
Про url() -- а что там страшного? Триммим аргумент, потом смотрим на 1 символ -- если кавычка (одинарная или двойная) и равен последнему символу -- триммим и их тоже.
Про padding -- да. У меня кроме как на веб-страничке нет возможности проверить, там точно не группируется.
from csso.
А если внутри URI окажется закрывающая скобка? Убрать кавычки — совершенно не проблема, правда. :) Проблема в том, что иногда их ставят именно потому, что без кавычек этот URI сломает CSS.
Уточним: почему вы считаете, что такой padding может группироваться? Вот описание (для padding те же правила): http://www.w3.org/TR/CSS21/box.html#margin-properties
В схеме T R B L (top, right, bottom, left) в варианте T RL B убрать B можно лишь в том случае, если B == T. Т.е. { padding: 1 2 1 } => { padding: 1 2 }, но в { padding: 2px 1px 1px } так не получится.
from csso.
Что касается кавычек в урле —можно проверять на то есть ли в кавычках скобки или другие «опасные» символы (если такие есть), и если их нет — убирать кавычки.
Очень часто кавычки вставляются какими-нибудь автоматическими тулзами и не всегда вычищаются.
from csso.
Простите, что торможу :-)
С url вопрос таки остаётся открытым: если кавычки убирать, то скобки, пробелы и кавычки надо экранировать (') или "эскейпить". Понятно, что выигрыш от убирания кавычек будет только в том случае, когда в url будет не более 1 такого символа. Наверное, нет смысла заморачиваться за подсчёт.
С padding вопрос снят, каким-то кривым способом я проверял на неправильном примере.
В качестве компенсации за неправильное замечение -- точно правильное:
-0 = 0
:-)
from csso.
Related Issues (20)
- @import statement on the bottom were removed HOT 1
- Wrong css property applied after restructuring
- Contents of the :is and :where pseudo-class functions is not optimized HOT 3
- ccoss
- how disabled colormin?
- csso ignores charset and always produces UTF-8
- Wrong border compressed result when with shorthand-border
- Shorten CSS Variable Names
- [bug] minifies removes @media tags HOT 4
- Update `css-tree` dependency HOT 2
- Minifying 0px within calc statements breaking site.
- Failure to Concatenate/Combine 2 CSS Selectors in Obscure Edge Case
- Duplicate content property removed
- Add support for CSS Nesting
- css
- Silently removes @media blocks containing "and (not ...)" HOT 3
- A bug with restructuring and shorthands
- CSS error breaks optimization HOT 2
- CSS
- TypeError: console.warn is not a function (ExecJS::ProgramError) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csso.