RefineryCMS Extension and assets

474 views
Skip to first unread message

Ricky AH

unread,
Oct 11, 2012, 4:02:30 AM10/11/12
to refine...@googlegroups.com
Hi
I'm developing an extension to refinerycms and I'm having problems loading assets in the admin part.

I pack all my engine's assets inside a js / css file with the name of the extension, and that file requires all the js/css files in the engine. So technically I only need to require that file to load the assets:
//= require refinery-myextension
/* require refinery-myextension

load paths are correct, but somehow they aren't loaded in the admin page (they do in the frontend website)

I've tried adding an admin.js file in my engine that also references myextension js/css but no luck

Any ideas?

Ricky AH

unread,
Oct 11, 2012, 4:29:21 AM10/11/12
to refine...@googlegroups.com
Ok, seems that javascript files are loading correctly after a server restart, but still can't add css to the admin part.

Javascript to the admin part is including creating an admin.js file with the appropiate require command, and put that file in my extension assets/javascripts directory That way the javascript code is only include in the admin part, but now in the website (as it is not needed there)

As the admin part of refinerycsm does not includes application.css, I'm trying to to a similar trick with the refinery.css file, which does seems to be included in the admin part, but it isn't working.

So I change my question: how can I add css assets only in the admin part of refinerycms?

Gilles Crofils

unread,
Nov 29, 2013, 9:27:21 PM11/29/13
to refine...@googlegroups.com
I've looked around but I haven't found any way to automagically include css.
According to refinerycms-blog code, it's required to hard code it in views.

<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/backend') %>

Mohamed El-Menisy

unread,
Mar 21, 2015, 3:51:32 PM3/21/15
to refine...@googlegroups.com
Under config/initializers/refinery you'll find a file named core.rb, in this file you can set an option to include your custom javascripts and css files which are located in your app/assets js and css folders like so:

       
# Register extra javascript for backend
config
.register_javascript "backend/script"


# Register extra stylesheet for backend (optional options)
config
.register_stylesheet "backend/custom", :media => 'screen'

and then restart your server and you're good to go.
Reply all
Reply to author
Forward
0 new messages