jquery-bootstrap and Themes

105 views
Skip to first unread message

Kevin Lawrence

unread,
Dec 14, 2012, 7:04:44 PM12/14/12
to communi...@googlegroups.com
I want to start customizing the look and feel of my app. I'm using the jquery-bootstrap branch.

Any suggestions as to how I should approach this? Create a theme? Copy-paste-edit the CSS from the CE plugin into my app?

TIA,

Kevin

Bruno Bornsztein

unread,
Dec 19, 2012, 2:56:19 PM12/19/12
to communi...@googlegroups.com
Hi Kevin,
The themes functionality that was present in previous versions of CE has been taken out in the Rails 3.x branch (now master). I'd do it by just creating your own CSS file(s) and including them after the communityengine.css. If you're using Rails 3, you can do this pretty easily using the asset pipeline. 

If you need to change any of the HTML in the layout or views, you can just override template files in your own application.

Good luck!
Bruno

--
You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/communityengine/-/2H8-2-32TpcJ.
To post to this group, send email to communi...@googlegroups.com.
To unsubscribe from this group, send email to communityengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/communityengine?hl=en.

Kevin Lawrence

unread,
Dec 19, 2012, 3:24:51 PM12/19/12
to communi...@googlegroups.com
Thank you! I am making good progress adding my own css files and overridden views.

Everything works great in development but I have had a series of problems in production that I mostly fixed by adding more and more assets to the precompile list like this:

    config.assets.precompile += %w(community_engine.js community_engine.css tag-it/tag-it.js tag-it/tag-it.css)

I wonder if I am missing a better way. The rails guide (and stackoverflow) suggests that I should be able to include assets from an engine using the require tag in my application.css but I wasn't able to get that to work. Not a big deal now. I am just curious.

One problem that I haven't yet resolved: i have my own version of layout.html.haml and have overridden several of the shared partials. In production the first page load blows up with

ActionView::Template::Error (layout.css isn't precompiled):
    1: = stylesheet_link_tag 'layout'
    2: = stylesheet_link_tag 'application'
    3:
    4: - if forum_page?

If I copy shared/_scripts_and_styles into my app and comment out the line that includes layout.css, everything works but, of course, I lose the styling. I have tried every permutation of creating my own layout.css, adding layout to config.assets.precompile.

I'm not asking anyone to research this for me but if I'm missing something obvious, please speak up :-) 

Thanks for the encouragement and the great engine. It will save me a ton of time and I hope I'll eventually be able to contribute something back.

Kevin


On Wednesday, December 19, 2012 11:56:19 AM UTC-8, Bruno wrote:

Good luck!
Bruno

Bruno Bornsztein

unread,
Dec 19, 2012, 3:33:25 PM12/19/12
to communi...@googlegroups.com
I wonder if I am missing a better way. The rails guide (and stackoverflow) suggests that I should be able to include assets from an engine using the require tag in my application.css but I wasn't able to get that to work. Not a big deal now. I am just curious.

This works in development, because the server is configured to serve static assets (config.serve_static_assets = true), so the request for the engine asset (communityengine.css) goes through the Rails stack. In production, it doesn't by default, so those assets will not be accessible unless you precompile them explicitly. Even better, just throw them into your application.css (which is precompiled by default). So, in application.css, do:

/*
 *= require communityengine
*/


 

One problem that I haven't yet resolved: i have my own version of layout.html.haml and have overridden several of the shared partials. In production the first page load blows up with

ActionView::Template::Error (layout.css isn't precompiled):
    1: = stylesheet_link_tag 'layout'
    2: = stylesheet_link_tag 'application'
    3:
    4: - if forum_page?

Again, unless you explicitly tell Rails to precompile layout.css, it won't be available in production. So either add it to the list of assets to precompile, or just include in application.css, as above. Generally speaking, you want to include one stylesheet and one javascript file (if possible) per page load (or at least the fewest number possible).
 
So in your case, I'd have an application.css file which I link in the layout.html.haml template. Then, in that application.css, you might have something like:

/*
 *= require communityengine
 *= require layout
*/

That way, the CE styles are loaded first, and you can then override them. 






If I copy shared/_scripts_and_styles into my app and comment out the line that includes layout.css, everything works but, of course, I lose the styling. I have tried every permutation of creating my own layout.css, adding layout to config.assets.precompile.

I'm not asking anyone to research this for me but if I'm missing something obvious, please speak up :-) 

Thanks for the encouragement and the great engine. It will save me a ton of time and I hope I'll eventually be able to contribute something back.

Kevin


On Wednesday, December 19, 2012 11:56:19 AM UTC-8, Bruno wrote:

Good luck!
Bruno

--
You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/communityengine/-/khjIN-lN8cwJ.
Reply all
Reply to author
Forward
0 new messages