sub theme css is not being added to site.

sub theme css is not being added to site.

by Wade Phillips -
Number of replies: 12

I have created a sub theme of the Bootstrap theme and I'm running on 2.6.3.  I have added a custom css file to my theme that makes a couple of small adjustments to my theme's overall look. And everything looks right when I'm using the theme designer mode   But when I turn theme designer mode off, it stops registering the first css rule.  It doesn't matter which rule, just the first one at the head of the file is skipped.  

I put a .bogusClass {background-color:#fff;} into the top of the css file, and now it works without theme designer mode.  But that seems weird, and I feel like I'm missing something.  Am I leaving out a header or missing something?

Average of ratings: -
In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Well it would help if you uploaded the custom css file for a start as you might have an error in it?

In reply to Mary Evans

Re: sub theme css is not being added to site.

by Wade Phillips -
I don't think that the css it's self is a problem.  The issue is more that if I delete my .bogusClass{} then .block .header{} will not work.  s:

/* Custom CSS
-------------------------*/
.bogusClass {background-color: #fff;} /*This is just a place holder, it is not needed except to hold the place because of an error.*/
.block .header{background-color: #a9dfe9;}
.navbar .logo {
    display: block;
    float: left;
  max-height: 38px;
  margin-top: 9px;
}
nav.navbar {background-color: #a9dfe9;}



In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It just does not make any sense, does it?

However, I do have an idea what it might be so can you please upload the actual custom stylesheet so I can test this out.

Thanks

Mary

In reply to Mary Evans

Re: sub theme css is not being added to site.

by Wade Phillips -
In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

And you say you are adding this CSS in a file, and not via your theme's custom settings CSS box then?

You call your theme a sub-theme can you explain how you have created this 'sub-theme'.

The reason I am asking these questions is that I think the reason why the CSS is failing is that it is coming in too early and then getting over written. So this could well depend on how and where the css file has been added in your theme.

On the other hand there could be some other problem in the HTML/php markup for the page.

Short of checking the theme over I honestly do not know.

Mary

In reply to Mary Evans

Re: sub theme css is not being added to site.

by Wade Phillips -

I'm calling it in theme/mytheme/config.php 


Here's the segment


 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

 */


$THEME->doctype = 'html5';

$THEME->yuicssmodules = array();

$THEME->name = 'bootstrappoca';

$THEME->parents = array('bootstrap');

$THEME->parentssheets = array('moodle', 'custom');

$THEME->sheets = array('bootstrappoca');  <---------


$THEME->supportscssoptimisation = false;


$THEME->editor_sheets = array('editor');


$THEME->plugins_exclude_sheets = array(




Have I gotten some of this wrong?

In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

You don't need these...

$THEME->parentssheets = array('moodle', 'custom');

as you get these by default from the parent theme, so no need to declare them again they are already mentioned in the parent theme. It may be these are being added twice now, which might be the cause of the problem.

You can exclude parent stylesheets...

$THEME->parents_exclude_sheets = array('bootstrap' => array('moodle'), 'clean' => array('custom'));

but I have never seen them being added....this does not make sense at all. Have you seen this done or just something you decided might be worth a try? smile

Anyway, take that line out and see if it works.

Might also be an idea to do a Purge all cache to clear any odd bits of data that might be fouling things up?

Cheers

Mary

In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Have you tried turning Debugging on?

One thing that comes to mind - the cutom.css in Bootstrap has two lines with a setting:customcss and a setting:brandcss, but I can't see a settings.php or anything in lib.php to create those settings, or any settings page when the theme is installed. 

Could this be causing an error that is then carrying into the child theme css until the first css statement is closed allowing the next one (ie second selector) to work correctly.

Try excluding the bootstrap theme custom.css (see Mary's post earlier) and see if that has any effect, as it seems to me that there's currently no need for this custom.css with these settings lines when there is no settings page to fill them.


Richard


Average of ratings: Useful (2)
In reply to Richard Oelmann

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

That was a VERY, VERY, VERY, USEFUL post Richard.

The mind boggles!!!

I'm not even going to ask why it was left there.

Thanks

Mary

In reply to Mary Evans

Re: sub theme css is not being added to site.

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Reported in the project bug tracker (on GitHib smile

https://github.com/bmbrands/theme_bootstrap/issues/307

In reply to Richard Oelmann

Re: sub theme css is not being added to site.

by Wade Phillips -

Thanks for the help Mary and Richard! 

This is my first attempt a creating a sub theme so I imagine I have done any number of things incorrectly.  I'm not sure where I picked up that $THEME->parentssheets line, maybe it was something I saw in a Youtube video tutorial that I had been following. b It seems that it was unnecessary.  I commented it and out and now my css is being included properly without the fake css selector.  I thought that I had tried removing it before, but maybe not.  Anyhow all seems to be well now.

Thanks for helping me out, I surely appreciate it!

In reply to Wade Phillips

Re: sub theme css is not being added to site.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Well glad it all works as it should now.

And you are very welcome to the help we give here.
It's actually things like this problem that we learn something too!

Cheers

Mary