RESOLVED: How to create children themes from another Boost child theme?

RESOLVED: How to create children themes from another Boost child theme?

by Fábio Rocha -
Number of replies: 7

Hi!

I'm using Moodle 3.2.1, and I have 2 themes (theme_mooc and theme_spoc - "boost" as parent for both) for 2 different projects.

Now those projects will have the same visual identity. So, I'm thinking about creating a third theme, so theme_spoc and theme_mooc can use it as a parent theme too.

In this new theme, I pretend to use SCSS variables and rules commom for both projects.

I've already created the new theme. But I can't work on making the CSS changes (posts.scss file) affects the other themes.

Is this possible to do on Moodle? What I am doing wrong?

(Edited by Mary Evans - RESOLVED - original submission Wednesday, 8 November 2017, 9:34 PM)

Average of ratings: -
In reply to Fábio Rocha

Re: How to create children themes from another Boost child theme?

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

Let me get this straight ... Is this the set up you have now?

theme_xxxx = child of theme_boost

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

theme_mooc = child of theme_xxxx & grandchild of theme_boost

  $THEME->parents = array('xxxx', 'boost');

theme_spoc = child of theme_xxxx & grandchild of theme_boost

  $THEME->parents = array('xxxx', 'boost');

If so, can you please let me see a section of the SCSS variables that you are using?

Thanks

Mary

Average of ratings: Useful (1)
In reply to Mary Evans

Re: How to create children themes from another Boost child theme?

by Fábio Rocha -

Exactly what I did. Thanks!

In fact, I've just acomplished what I wanted. I've just updated this funcion at the lib.php file from theme_mooc:

function theme_mooc_get_main_scss_content($theme) {
    global $CFG;

    $scss = file_get_contents($CFG->dirroot . '/theme/boost/scss/preset/default.scss');
    $pre_geral = file_get_contents($CFG->dirroot . '/theme/geral/scss/pre.scss');
    $post_geral = file_get_contents($CFG->dirroot . '/theme/geral/scss/post.scss');
    $pre = file_get_contents($CFG->dirroot . '/theme/mooc/scss/pre.scss');
    $post = file_get_contents($CFG->dirroot . '/theme/mooc/scss/post.scss');

    return $scss . "\n" . $pre_geral . "\n" . $post_geral . "\n" . $pre . "\n" . $post;
}

The $pre_geral and $post_geral solved my problem. smile

In reply to Fábio Rocha

Re: How to create children themes from another Boost child theme?

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

Bravo!

In reply to Mary Evans

Re: How to create children themes from another Boost child theme?

by Fábio Rocha -
Thanks! How can I mark this post to RESOLVED?
In reply to Fábio Rocha

Re: How to create children themes from another Boost child theme?

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

Sorry I forgot to do that. I will attend to it now!

Cheers

Mary

In reply to Fábio Rocha

Re: How to create children themes from another Boost child theme?

by Fábio Rocha -

Hi! I'm getting a related error in this configuration:

The file /theme/boost/scss/bootstrap/_variables.scss is overwritten all my pre.scss files on both themes.

How to prevent from this happen?

In reply to Fábio Rocha

Re: How to create children themes from another Boost child theme?

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

Why is theme_geral mentioned?
each child theme should have its own the relavent function that relates to the scss files if those files
names have been changed.

No wonder Boost is overriding the SCSS that's possible because this is wrong

function theme_mooc_get_main_scss_content($theme) { global $CFG; $scss = file_get_contents($CFG->dirroot . '/theme/boost/scss/preset/default.scss'); $pre_geral = file_get_contents($CFG->dirroot . '/theme/geral/scss/pre.scss'); $post_geral = file_get_contents($CFG->dirroot . '/theme/geral/scss/post.scss'); $pre = file_get_contents($CFG->dirroot . '/theme/mooc/scss/pre.scss'); $post = file_get_contents($CFG->dirroot . '/theme/mooc/scss/post.scss'); return $scss . "\n" . $pre_geral . "\n" . $post_geral . "\n" . $pre . "\n" . $post; }