Skip to content

Cook / Serve overwrites main styles #144

@ricardofreeman

Description

@ricardofreeman

Hi, I have a main css file overwriting some styling applied by the css files coming from some jQuery plugins.
I would like to serve the assets for these widgets BEFORE I invoke this main css file.

My main css file is invoked in the config.php file (which also cooks the groups I'll need for each widget) but then when the page renders, the widgets are called after my css file, overwriting any changes I made.

config.php

'beforeRenderTheme' => function($theme)
{
    // Owl Carousel -- served by the controller Merchandising.php
    $theme->asset()->cook('owlCarousel', function($asset) {
        $asset->usePath()->style('owlcarousel', 'css/owl.carousel.min.css');
        $asset->container('footer')->usePath()->add('owl', 'js/plugins/owl.carousel.min.js');
    });

    $theme->asset()->usePath()->style('styles', 'css/styles.css');
}

Merchandising.php

public function init(Theme $theme)
{
    $this->theme->asset()->serve('owlCarousel');
    (...)

I found dependencies in the documentation but doesn't seem to be working with cook/serve, am I missing something?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions