laravel-theme icon indicating copy to clipboard operation
laravel-theme copied to clipboard

Cook / Serve overwrites main styles

Open ricardofreeman opened this issue 7 years ago • 0 comments

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!

ricardofreeman avatar Jul 28 '17 11:07 ricardofreeman