There have been a few requests in the short life-span of this module already for support for adding css files that are not related to your active theme.

  • First request was for module css
  • Second request was to add a path manually relative to the sites dir (via #912238)

This issue is to open up discussion and share my thoughts on how to handle this.

CommentFileSizeAuthor
#5 Screenie-Of-New-Reactions.png31.52 KBelectblake

Comments

electblake’s picture

I see the following options:

* On an administration page (sites > config > context add assets) there is an option to manually add paths for context_addassets to index to be shown on the "Add Theme CSS" section, or possibly another reaction entitled "Add Module CSS" or simply "Add CSS" ?

* On an administration page (sites > config > context add assets) there is a list of all modules recognized by the system, which you can click enable/disable inclusion into the Add Assets index, and the renaming conventions for the reaction (from above point) still apply.

Remarks?

milos.kroulik’s picture

I vote for another reaction to keep things clean as possible and accessible in the Context interface.

electblake’s picture

Assigned: Unassigned » electblake

Ok - so I'm going to create an admin interface for selecting module(s) to be added to a "Add Module CSS" reaction and another for entering in arbitrary paths, and an "Add Generic CSS" reaction (or maybe different language there, any suggestions?)

milos.kroulik’s picture

Maybe "Add custom CSS"? But I am OK with anything.

electblake’s picture

Status: Active » Needs review
StatusFileSize
new31.52 KB

So I've added 2 more ways of finding Assets, both of which are access at: admin/build/context/addassets

  • Add Assets from Modules
  • Add Assets from File Paths

See screenshot for full list of all reactions now.

commit #423304

electblake’s picture

once this feat. has been tested going to issue a release for 1.0-beta1

ebeyrent’s picture

I cannot seem to get this to work.

My modules directory uses a structure of

- sites/all/modules/contrib
- sites/all/modules/custom

All of my custom modules that provide a css file do so in a css directory within the module.

My themes directory uses the same structure.

Regarding the themes, I have a custom base theme which is a subtheme of Fusion, and sub-themes of the custom base theme.

After configuring the module with my custom modules and a custom path, I am unable to add any css via the Context UI interface. I add the reaction and get the message "No Assets Found".

ebeyrent’s picture

As it turns out, if I change

$files_raw[$name] = file_scan_directory($dir, $mask);

to

$files_raw[$name] = file_scan_directory($theme['path'], $mask);

it works for the themes. In the paths and modules cases, this works for me:

$files_raw[$path] = file_scan_directory($path, $mask);

electblake’s picture

interesting - I'll take another look at this :)

macaronibros’s picture

Hi, similar issue here.
We have a site installed in a subdir of the webserver root (like www.example.com/site).

At line 335 this instruction
$dir = realpath('.') . base_path() . $theme['path'];
result in a double inclusion of /site, since it's already
included in realpath('.') and then taken again by base_path().

We solved by patching like 338 like that
$files_raw[$name] = file_scan_directory($theme['path'], $mask);

eynie’s picture

Similarily, in case of File Paths, while working on Windows workstation (as in development environment) in the indexed path the site directory is repeated and directory separators are getting mixed.
Example:
C:\WWW\server_root\site_directory/site_directory/sites/all/themes/my_theme/custom-css-dir

Replacing
$dir = realpath('.') . base_path() . $path;
with
$dir = $path;
works for me, but i think it should be resolved more proper way.