Giter Club home page Giter Club logo

Comments (4)

matthieu-beteille avatar matthieu-beteille commented on May 23, 2024

Hi, thank you for the kind message 👍

This is something really quick to add. I'll have a look and try to implement this today or tomorrow.

Correct me if I am wrong, but you'll need to get the generated css as well as the map between selectors and localised selectors.

I see two solutions here:

  1. I can reuse the same macro to check if the macro is supposed to produce clj code or cljs code.
    If clj: the macro will define a map containing both the generated css, and the map between selectors
    If cljs: the macro will behave as it is now (injecting the css and only defining the map between selectors).

  2. I can create two different macros, one for each use case.

For now, I'd go for the first solution, would that be good enough for you to get started?

from cljs-css-modules.

groundedsage avatar groundedsage commented on May 23, 2024

I believe the first one would be fine. I'm still new to the programming and web space (my background is in design). This is what I will be using it for which currently only needs the code to be rendered serverside https://github.com/CommonCreative/vbn-redesign.

from cljs-css-modules.

matthieu-beteille avatar matthieu-beteille commented on May 23, 2024

I made the change and created a PR #8

I just deployed to clojar the new SNAPSHOT, you can try using this version
[cljs-css-modules "0.2.1-SNAPSHOT"].

If you now use the macro from clojure, it will define a map containing both the generated css and the map between original selectors and localised selectors.

For instance:

(defstyle style
  {:pretty-print? false}
  (at-keyframes "animation-1"
                [:from {:top "0px"}]
                [:to {:top "200px"}])
  (at-keyframes "animation-2"
                [:from {:top "0px"}]
                [:to {:top "250px"}])
  ["@keyframes animation-3" [:from {:top "0px"}]
                            [:to {:top "250px"}]])

In this case style would be the following map:

{:map {:animation-1 "animation-1--G__1524"
       :animation-2 "animation-2--G__1524"
       :animation-3 "animation-3--G__1524"}
 :css "@keyframes animation-1--G__1524{from{top:0}to{top:200px}}@keyframes animation-2--G__1524{from{top:0}to{top:250px}}@keyframes animation-3--G__1524{from{top:0}to{top:250px}}"}

I hope this will help, if you could try it and then give me your feedback that would be awesome!

from cljs-css-modules.

matthieu-beteille avatar matthieu-beteille commented on May 23, 2024

This is now part of version 0.2.1. Closing the issue

from cljs-css-modules.

Related Issues (5)

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.