Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render CSS to a file #1

Closed
erwagasore opened this issue Apr 12, 2013 · 5 comments
Closed

Render CSS to a file #1

erwagasore opened this issue Apr 12, 2013 · 5 comments

Comments

@erwagasore
Copy link

in gaka if I remember correctly you can specify where the group of rules will be saved inside resources?

@noprompt
Copy link
Owner

Good catch. I've been so focused on getting the compiler/code generation part off the ground I hadn't thought about how best to approach that. But I think it's something simple enough it could be added soon. In the mean time, the css macro will produce a string for you which could easily be dumped in a file.

I'll try to get this in to the beta version by the end of the week, if not it'll definitely be in 0.1.0 stable.

@erwagasore
Copy link
Author

I am trying to build a CSS Framework based on garden, at first I wanted to build my own css generation lib 'cause I wasn't satisfied buy neither gaka nor cssgen. Now that there is garden I don't need to create something else.

I am pretty new into clojure, I don't know good practices but I can contribute by dealing with small tasks if u r up to correct my mistakes along the way

@noprompt
Copy link
Owner

Sorry it's taken me a bit to get back to you on this issue. I've done a bit of thinking about it and my thoughts are this: having a save-css function, while nice, is out of the scope of this library. In the case of gaka it's really just a thin layer of sugar for calling css and saving the result to a file (which you still requires you to specify a path and isn't particularly unique behavior for any library). So unless there is a very strong use case beyond convenience, I'm going to avoid adding this to the library.

Since you're getting started with Clojure and I don't want to leave you out in the cold, you could try a variation on this:

(ns my-project.stylesheets)

(def stylesheets-dir "resources/public/stylesheets/")

(def screen
  (css 
    ; Rules
  ))

(defn- save-stylesheet
  [filename styles]
  (with-open [writer (clojure.java.io/writer (str stylesheets-dir filename)]
    (.write writer styles)))

(save-stylesheet "screen.css" screen-css)

This is pretty close to code I'm using right now to render and save my stylesheets to disk during development. If you're developing with an editor like Emacs or Vim that's able to communicate with nREPL, all it takes is loading the file to recompile the stylesheet(s). Of course, you may want to tweak this a bit if you want the stylesheets to be recompiled before deployment, etc.

I am trying to build a CSS Framework based on garden...

I'd love to see how that goes. Now that Garden has media query support it should be easier to make a really nice framework of some kind. Though it'd take an act of god, having something like Compass, Foundation, or Gumby(http://gumbyframework.com/) brought to the Garden world would be nothing short of awesome. There's a lot of awesome stuff to bring over like modular scale and grid systems.

Be sure to keep an eye on the library over the next few weeks though as I'm planning to have the library at 0.1.0-stable by or before June. Thanks again for the suggestion!

@noprompt
Copy link
Owner

@erwagasore So I'd like to apologize for my initial resistance to adding this feature to the library. It was added in d5da87d and will be available for use in 1.0.0.

Thanks again!

@erwagasore
Copy link
Author

I am glad you decided to add this feature.

Nice work man, keep it up.

Eugene R.

On Tue, Sep 17, 2013 at 10:16 AM, Joel Holdbrooks
notifications@github.comwrote:

@erwagasore https://github.com/erwagasore So I'd like to apologize for
my initial resistance to adding this feature to the library. It was added
in d5da87d d5da87d9 and will
be available for use in 1.0.0.

Thanks again!


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-24571040
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants