Jump to content

Is it possible to specify the loading order of styles


Jochen Fritsch
 Share

Recommended Posts

Hi there,

I´m struggeling with the RockFrontend $rockfrontend->styles()->add() order.

	$rockfrontend->styles()
		->add($config->urls->templates . 'css/vendor/bootstrap.min.css')
		->add($config->urls->templates . 'css/vendor/slick.css')
		->add($config->urls->templates . 'css/vendor/slick-theme.css')
		->add($config->urls->templates . 'css/vendor/lightbox.min.css')
		->add($config->urls->templates . 'css/vendor/icomoon.css')
		->add($config->urls->templates . 'css/vendor/animate.min.css')
		->add($config->urls->templates . 'css/main.less')
		->minify(true);

outputs

  <link href='/site/templates/bundle/main.min.css?m=1737104643' rel='stylesheet'>
  <link href='/site/templates/css/vendor/bootstrap.min.css?m=1708339600' rel='stylesheet'><!-- _head.php:7 -->
  <link href='/site/templates/css/vendor/slick.min.css?m=1737101709' rel='stylesheet'>
  <link href='/site/templates/css/vendor/slick-theme.min.css?m=1737101709' rel='stylesheet'>
  <link href='/site/templates/css/vendor/lightbox.min.css?m=1708339600' rel='stylesheet'><!-- _head.php:10 -->
  <link href='/site/templates/css/vendor/icomoon.min.css?m=1737101709' rel='stylesheet'>
  <link href='/site/templates/css/vendor/animate.min.css?m=1708339599' rel='stylesheet'><!-- _head.php:12 -->

the main.less File is always the first file in the output order.

Ist there a Parameter or something where I cand define the order?

Thanxs folks!

Link to comment
Share on other sites

Hey @Jochen Fritsch thx for your question. This is unfortunately not possible ATM. LESS files are always parsed first. The reason is that there might be more then one less file to parse and then the module can not know where to put the final css file, so it will always put parsed CSS from less very first.

You can use the LESS module standalone to create the CSS and then ->add() that to rockfrontend's styles. Or you just add all <link> tags to your main markup manually, which might be the best option 🙂 I'm not really happy anymore with RockFrontend's asset features.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...