Code Monkey home page Code Monkey logo

Comments (13)

osban avatar osban commented on June 12, 2024 1

Personally I'm happy with things as they are now...using helpers is pretty easy πŸ™‚

from bss.

osban avatar osban commented on June 12, 2024

Wouldn't there be a problem when you want border: 0 and do b(0)?

from bss.

porsager avatar porsager commented on June 12, 2024

Wouldn't you write b none?

from bss.

porsager avatar porsager commented on June 12, 2024

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.

futurist avatar futurist commented on June 12, 2024

πŸ‘

β€œ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.

osban avatar osban commented on June 12, 2024

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.

porsager avatar porsager commented on June 12, 2024

@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.

porsager avatar porsager commented on June 12, 2024

@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.

osban avatar osban commented on June 12, 2024

@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.

porsager avatar porsager commented on June 12, 2024

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.

porsager avatar porsager commented on June 12, 2024

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.

smuemd avatar smuemd commented on June 12, 2024

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.

porsager avatar porsager commented on June 12, 2024

@smuemd Yeah, those could simply be extra libraries used like

import tachyons from 'bss-tachyons'
b.helper(tachyons)

from bss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.