Suggestions for optimization

155 views
Skip to first unread message

Jonathon McKitrick

unread,
Mar 16, 2015, 10:00:15 PM3/16/15
to clojur...@googlegroups.com
I'd like suggestions on how to take advantage of current optimization settings and perhaps the new module feature, especially in production. I'm going to explain some of the decisions I've made, then paste in the relevant bits of my project file.

1. It's a tabbed app, where each tab is a SPA with a new entry point in a different namespace in a monolithic js payload: main.js.

2. jQuery is required by Bootstrap, and Bootstrap has its own js file.

3. I've tried several combinations of settings to get small payload without issues with externs and name-mangling, to varying degrees of success. Lately, I cannot get :advanced to work as I have it here.

So, here goes:

{:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/main.js"
:optimizations :simple
:cache-analysis true
;:externs ["jquery/jquery-externs.js" ] ;"public/vendor/js/bootstrap.min.js"
:preamble ["jquery/jquery-2.1.1.min.js" "public/vendor/js/bootstrap.min.js"] ; "reagent/react.js"
}}

I leave the externs in because in the past they have helped. I also took react.js out, because cljsjs.react replaces it nicely.

I'm open to suggestions! And questions....

Atamert Ölçgen

unread,
Mar 22, 2015, 7:47:37 PM3/22/15
to clojur...@googlegroups.com
On Tue, Mar 17, 2015 at 4:00 AM, Jonathon McKitrick <jmcki...@gmail.com> wrote:
I'd like suggestions on how to take advantage of current optimization settings and perhaps the new module feature, especially in production.  I'm going to explain some of the decisions I've made, then paste in the relevant bits of my project file.

1.  It's a tabbed app, where each tab is a SPA with a new entry point in a different namespace in a monolithic js payload: main.js.

2.  jQuery is required by Bootstrap, and Bootstrap has its own js file.


3.  I've tried several combinations of settings to get small payload without issues with externs and name-mangling, to varying degrees of success.  Lately, I cannot get :advanced to work as I have it here.

So, here goes:

{:source-paths ["src/cljs"]
                            :compiler {:output-to "resources/public/js/main.js"
                                       :optimizations :simple
                                       :cache-analysis true
                                       ;:externs ["jquery/jquery-externs.js" ] ;"public/vendor/js/bootstrap.min.js"
                                       :preamble ["jquery/jquery-2.1.1.min.js" "public/vendor/js/bootstrap.min.js"] ;  "reagent/react.js"
                                       }}

I leave the externs in because in the past they have helped.  I also took react.js out, because cljsjs.react replaces it nicely.

I'm open to suggestions!  And questions....

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.



--
Kind Regards,
Atamert Ölçgen

◻◼◻
◻◻◼
◼◼◼

www.muhuk.com

Daniel Kersten

unread,
Mar 23, 2015, 6:37:01 AM3/23/15
to clojur...@googlegroups.com
I've also had good results with just not using the bootstrap .js (and therefore also not using jQuery). You lose out on a few widgets, but I didn't find it a big deal (and then started using react-bootstrap and such instead anyway).

Jonathon McKitrick

unread,
Mar 23, 2015, 7:58:29 AM3/23/15
to clojur...@googlegroups.com
The one in particular I need is show/hide modal.

Also, how did you work around the error message when jQuery is not present?


--
Jonathon McKitrick

You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/irz52JVayto/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.

Oliver George

unread,
Mar 23, 2015, 5:47:15 PM3/23/15
to clojur...@googlegroups.com
I've had good success implementing Modal dialogs which build on the Bootstrap styling but not using the JavaScript Bootstrap provides.

I'll share my current implementation but I think there's reason to consider taking a slightly different approach to state.  If I was starting from scratch I would have a :modal key in my top level app state and use that to show/hide a modal.  You might do that with a multimethod.


I also have an outstanding scrolling bug to address.

Oliver George
Director, Condense
0428 740 978
Reply all
Reply to author
Forward
0 new messages