Well, I made sure you can do it:).  I created the grouped middleware 
functions for convenience's sake and I intend to add more.

Something like that will work:

(let [loader (resource-loader "/precompiled")]
(->
  (some-fn (wrap-lesscss-processor loader)
           (wrap-coffeescript-processor loader)
           (resource-loader "/public"))
  (cond-> devmode
    (->
      (wrap-yui-css-compressor)
      (wrap-uglify-js-compressor)))))

Of course you will have to (use ...) more namespaces.

Although this might not be good enough, because:

   1. LessCSS files should be listed. You will usually want to compile only 
   one or two of them, the rest will be @imported. SASS has convention to mark 
   those files  with underscore _ at the beginning of filename, but LESS 
   doesn't have any solution like that, so...
   2. If you specify files to compile, they will be precompiled and any 
   compilation errors will be found immediately as the app won't start.
   3. I tried separate caching layer, but it doesn't work so good. It gets 
   especially complex with LessCSS - you have to watch imported files for 
   changes too. Also, I want to add transformation with non-java tools. 
   Integrating with those usually is based on filesystem anyway.

Marcin


W dniu sobota, 16 listopada 2013 13:08:18 UTC+1 użytkownik James Reeves 
napisał:
>
> Hi Marcin,
>
> Why did you choose to group LESS compilations, CoffeeScript minification, 
> caching and resource minification in one middleware function? Why not have 
> a separate middleware function for each?
>
> For example, instead of:
>
> (compiled-assets-loader
>  "precompiled"
>  :lesscss-list ["css/bootstrap.less"]
>  :mode :prod)
>
>
> Consider instead a structure like:
>
> (-> (route/resources "/*.less")
>     (wrap-compile-less)
>     (wrap-minify-css)
>     (wrap-cache (file-cache "tmp/less/compiled"))
>
>
> You'd get the same functionality, but in a form where each function does a 
> specific task.
>
> - James
>
>
> On 16 November 2013 01:40, Marcin Skotniczny <cosmi...@gmail.com<javascript:>
> > wrote:
>
>>
>> <http://upload.wikimedia.org/wikipedia/commons/6/6d/Cornet2.png>
>> https://github.com/cosmi/cornet
>>
>> Cornet is a simple asset pipeline that will help you compile on the 
>> flight LessCSS, CoffeeScript and minify all your CSSes and JSes.
>>
>> I wasn't happy with what's already there 
>> (dieter<https://github.com/edgecase/dieter> isn't 
>> really in spirit of Clojure) - I wanted something simple to use and 
>> compatible with Compojure. So here it is - my third iteration of the idea.
>>
>> There's simple basic usage described in the README, but I am really proud 
>> of the architecture of the library. It is very extendable and can combine 
>> transformations in any way you want, so I will work on new usage modes if 
>> needed (or you can figure it out by yourself :) ).
>>
>> Let me know what you think.
>>
>> Also, how are you managing this now?
>>
>>
>> Marcin
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to