ismamz / postcss-utilities Goto Github PK
View Code? Open in Web Editor NEWPostCSS plugin to add a collection of mixins, shortcuts, helpers and tools for your CSS
Home Page: https://ismamz.github.io/postcss-utilities
License: MIT License
PostCSS plugin to add a collection of mixins, shortcuts, helpers and tools for your CSS
Home Page: https://ismamz.github.io/postcss-utilities
License: MIT License
Like this one https://www.npmjs.com/package/postcss-text-stroke
I realise this is not directly relevant to the plugin,
but tried to look for ways to add the '@Util' to css/scss syntax highlighting in Atom editor
but couldn't find a reference for it.
Anyone has any advice?
The output for @Util circle is:
.circle {
height: 200px;
width: 200px;
border-radius: 50%;
color: #268BD2;
}
Where color
should be background-color
How about adding height
and style
arguments to hr?
/* signature: hr( [color], [vertical-margin], [style], [height] ) */
/* defaults: style = solid, height = 1px
/* before */
hr {
@util hr(#000, 20px, dashed, 10px);
}
/* after */
hr {
height: 0;
border: 0;
border-top: 10px dashed #000;
margin: 20px 0;
display: block;
}
Hello, it will be better if you can add max/min size for both width and height to the size shortcut or even create new shortcuts like min-size and max-size something like what they did here in this plugin postcss-short-size.
Thanks
Hi! I found a bug with centerMethod option. Problem with number of argument in center function. This problem was solved in last pull request, but last version in npm is still 7.0. Can you provide new release?
Isn't it better to use flexbox to center vertically?
Sometimes it's need to center block only vertically or horizontally. Maybe it's worth to replace center
with more general align( [vertical], [horizontal] )
. vertical
argument can be one of top
, center
, bottom
and horizontal
argument can be one of left
, center
, right
:
/* before */
.centered {
@util align(center, center);
}
.aligned {
@util align(bottom, right);
}
/* after */
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.aligned {
position: absolute;
bottom: 0;
right: 0;
}
Also It may be useful to have fill
values for both arguments:
/* before */
.fill-horizontally {
@util align(center, fill);
}
/* after */
.fill-horizontally {
position: absolute;
top: 50%;
left: 0;
rigth: 0;
transform: translateY(-50%);
}
All this behaviour can be implemented with flexbox
method too
Hi, I wanted ask, why you choose implementation with wrapper ?
I think this realization more clean - http://mystrd.at/modern-clean-css-sticky-footer/
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px; /* bottom = footer height */
}
footer {
position: absolute;
left: 0;
bottom: 0;
height: 100px;
width: 100%;
}
Webkit only bug.
Chromium bugtracker
Any reason not to?
Such as title
We need to find the best way to use flexbox for sticky footer utility.
Reminder to go through documentation/website, proofreading as well.
Hi - Thanks for the helpful plugin!
I believe i've discovered a bug with @util hr;
As per the documentation, 4 parameters can be passed to the hr
utility. This works as expected as far as functionality.
The Issue:
I'm currently getting a warning in the build output when I pass only one param or when I pass more than 2 params.
It seems that the issue lies in the walkAtRules function in index.js
Solution: Regarding @util hr;
, based on documentation, you should be able to pass 0-4 parameters with out any warnings.
There are no AST API changes. We just need to update dependencies.
Add HTTPS on the website. https://github.com/blog/2186-https-for-github-pages
I've noticed that the clearfix util is using the display: table/block
method, however there is a more modern approach which is to use display: flow-root
.
A demo is here showing it off.
Hi!
I am using this plugin with webpack and postcss-loader with postcss-load-config to load config from package.json.
In package.json I've got it configured like this:
...
"postcss": {
"plugins": {
"postcss-import": {},
"postcss-url": {},
"postcss-utilities": {
"centerMethod": "flexbox",
"textHideMethod": "font"
},
"postcss-cssnext": {},
"postcss-browser-reporter": {},
"postcss-reporter": {}
}
},
...
And it seems to ignore passed option "centerMethod" - to use flexbox centering instead.
It keeps using the default one transform.
However! Passing option "textHideMethod": "font", works without problems.
I believe there's a typo somewhere, which doesn't switch to flexbox as intended?
Depedencies:
"postcss-utilities": "^0.7.0",
"webpack": "^3.8.1",
"postcss-loader": "^2.0.8",
Hi, I often set images as backgrounds, especially when I need specific ratio, maybe mixin for that can look something like this
.thumb-image {
@util bg-image(/assets/images/awesome-image.jpg);
}
.thumb-image {
background-image: url(/assets/images/awesome-image.jpg);
background-position: center;
background-size: cover;
}
Or maybe in combination with aspect-ratio mixin
.thumb-image {
@util aspect-ratio(16:9);
@util bg-image(/assets/images/awesome-image.jpg);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.