MontrealDevOne
MontrealDevOne

Reputation: 1044

Where to place css folder for joomla component

I world like to know where can I place my css folder for my joomla components. I have my commponent directory structure like this.

com_component/
    site/
        views/
        models/
        controllers/

should I add a css folder under site/ or site/views/

Upvotes: 0

Views: 998

Answers (3)

Patrick Jackson
Patrick Jackson

Reputation: 335

You could also put it into the views for the component, and that way users can create a Template Output Override for the component in their own templates so that updating the component does not update their changes.

http://docs.joomla.org/Understanding_Output_Overrides

@betweenbrain I'm not sure which is the "best practice" - creating the view in the component so the template override can be created, or creating it in the media folder?

Upvotes: 1

betweenbrain
betweenbrain

Reputation: 840

Typically, it would be under site/. But, you may also consider adding it to /media/com_component. Take a look at http://www.babdev.com/blog/139-use-the-media-folder-allow-overridable-media

Upvotes: 2

David Fritsch
David Fritsch

Reputation: 3731

Typically, you will see one of the following:

Add an assets folder within site and then put any component asset in folders within that (js, css, images, etc). Be sure to include this folder in your base xml file if using the installer.

The more common method presently is to create a media folder and reference that. So in your install file, create a sibling folder to site called media. In that add a css folder and put css files in there. In your install file, you would add the following set to make sure that the files get installed. Final destination will be SITE_ROOT/media/com_name/css/css_file.css:

<media folder="media" destination="com_name">
    <folder>css</folder>
</media>

Upvotes: 2

Related Questions