GithubHelp home page GithubHelp logo

prefixing (snippet included) about garden HOT 3 CLOSED

noprompt avatar noprompt commented on May 18, 2024
prefixing (snippet included)

from garden.

Comments (3)

noprompt avatar noprompt commented on May 18, 2024

I like the idea of a prefix function, but I think this could be a bit more generic. Maybe something like

(defn prefix
  "Attach a CSS style prefix to s."
  [p s]
  (let [p (u/to-str p)]
    (if (= \- (last p))
      (str p s)
      (str p \- s))))

(defn vendor-prefix
  "Attach a CSS vendor prefix to s."
  [p s]
  (let [p (u/to-str p)]
    (if (= \- (first p))
      (prefix p s) 
      (prefix (str \- p) s))))


(prefix "font" "family")
;; => "font-family"
(prefix "-webkit" "border-radius")
;; => "-webkit-border-radius"
(vendor-prefix "webkit-" "border-radius")
;; => "-webkit-border-radius"

These functions could then be reused anywhere prefixing is an issue.

from garden.

crooney avatar crooney commented on May 18, 2024

Hey, thanks for replying.

I'm not concerned with the mechanics of prefixing, but rather that whatever it is

  • returns a function that I can apply to a sequence to produce a derived function that will give me the rule repeated with the set of prefices I need.
  • inserts the repeated rule into the instant selector, hence the :&.

Of course, I can just do what I've done here, I just thought it might be of general benefit, as the vendor prefixing thing is the biggest PITA about css (for me, anyway; I'm still a novice at it).

from garden.

noprompt avatar noprompt commented on May 18, 2024

This feature has been added to garden.util. It will be apart of v1.0.0 soon. Thanks for opening this issue.

from garden.

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.