Comments (13)
Personally I'm happy with things as they are now...using helpers is pretty easy π
from bss.
Wouldn't there be a problem when you want border: 0
and do b(0)
?
from bss.
Wouldn't you write b none
?
from bss.
Hmm sadly not I see π https://stackoverflow.com/questions/2922909/should-i-use-border-none-or-border-0
Yeah, so that might be a pretty annoying gotcha..
from bss.
π
βPremature optimization is the root of all evilβ
- Donald Knuth.
Maybe no magic rather than little magic π
If a project use bss with shortcuts all over, then it's very hard to be transformed, and if later refactored by another person, and what if he/she don't know bss at all?
Shortcut is cool! But, less magic is better.
Sorry for the noise π it's maybe not related to the issue at all.
from bss.
You could of course implement a number of bss specific shorthands, like bo
for border, bor
for border-radius, and br/bl/bb/bt
for the specific borders. Atm I use helpers for those, as well as f.e.:
abs: b.position('absolute')
, which is still shorter than p absolute
π
from bss.
@futurist Yeah, that's also my main pain point about it.. It's the same kind of footgun that helpers can invite.
Speaking of helpers, I guess this solution could easily be written as a helper too though
b.helper({
p: (v, ...rest) => /[0-9]/.test(v)
? b.padding(v, ...rest)
: b.position(v)
from bss.
@osban Hehe.. br
works for border-radius ;)
I don't like the inconsistency of having bo
et al.. It's kind of an unpredictable rule..
from bss.
@porsager I know, but I don't like the inconsistency of
bt
= border-top
bl
= border-left
br
= border-radius <-- should be border-right
bb
= ? <-- should be border-bottom
π
from bss.
Hehe.. that's why they're not directly mapped in bss :P I think I should probably be more strict about the shorthands instead of automapping ones which aren't in https://github.com/porsager/bss/blob/master/lib/popular.js
It suffers a bit from my personal usage in that I almost never use borders, so not having a shorthand for borders was never an issue for me..
from bss.
Cool. Thanks for the feedback everyone π
I'd like to add some better descriptions for helpers in the docs and some conventions for building helper libraries as well..
from bss.
I would also keep it as is. Maybe optionally with a config flag to choose from a predefined list of flavors e. g. (1) Tachyons, (2) Basscss, (3) maybe SuitCss, are there others? No magic necessary.
from bss.
@smuemd Yeah, those could simply be extra libraries used like
import tachyons from 'bss-tachyons'
b.helper(tachyons)
from bss.
Related Issues (20)
- POJO style question HOT 7
- using bss-react module just for react HOT 10
- Allow multiline property value declarations HOT 2
- v2: Extract shorthands into helpers object
- v2: letter-spacing auto px
- Unit interpolation fails in node HOT 1
- convert fractions to percentage values HOT 6
- assign deeper HOT 3
- document how helpers can be used in lean strings HOT 1
- Simple integration width vuejs. HOT 1
- Line Height when given a unitless value doesn't return as expected HOT 3
- SVGs defined in background data urls don't work HOT 1
- Helpers defined with hyphen-case never get called HOT 1
- `$nest` and `$media` not applying style. HOT 3
- Feature Request: Built-in CSS Class Composition HOT 7
- Partial application overload for binary signature methods HOT 9
- Duplicate selector doesn't concat style. HOT 2
- Debug mode makes bugs harder to find HOT 1
- Some functions don't work on Mozilla Firefox lastest update (97.0) HOT 2
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 bss.