Jump to content

RockPageBuilder – rename main.css


nurkka
 Share

Recommended Posts

When using LESS files in blocks, RockPageBuilder compiles them automatically (I believe by using RockFrontend) to one main.css file and includes it in the <head>.

Is there any setting or config option to change the name main.css to something else?

 

 

Link to comment
Share on other sites

Hey @nurkka thx for your question!

      $rf = $this->rockfrontend();
      if ($rf) $rf->styles()->addAll('/site/templates/RockPageBuilder', '', 3);

this is what adds all blocks' .less files to the frontend. The default styles() array will compile files to main.css; I could either add a config setting to prevent this, or a module setting, or make it hookable.

What would be the ideal workflow/result for you?

Link to comment
Share on other sites

Thanks @bernhard , I think it would be best, if there was a config setting and an option in the module settings UI. Then the option can be easily copied to other projects with the config.php and also has a visible representation in the UI. That would also be similar to the other options which are listed there, like e.g. "Create LESS file for new blocks".

 

Link to comment
Share on other sites

  • 2 weeks later...

Maybe I mixed something up in my head?!

tQubPNt.png

I thought this was solving your problem. If not, could you please describe the problem again and with more details. Steps to reproduce, etc. Thx!

Link to comment
Share on other sites

Ah, yes, I am already using the feature to deactivate RockPageBuilder.min.css. The question why I started this thread was the ability to rename the CSS file which RockPageBuilder automatically generated from all block LESS files. The default is main.css and main.min.css, but I couldn't find any setting, where one could rename this CSS files.

It would have been nice, to be able to rename the autogenerated CSS, but while finishing my last project, I came to the conclusion not to use the block LESS files, because personally, I am using SCSS for global styles, and so I wrote my block styles in my SCSS in another place. So in my case, the main.css is not generated by RockPagebuilder anymore.

I would find it cool, if I could use the block style files again, but then only with SCSS and that would surely mean a lot of work on your part. So for now, we could leave this topic, as the feature to rename the main.css seems not to be needed right now.

Link to comment
Share on other sites

Ok thx. The reason why it ends up in main.css is actually 50% because of RockPageBuilder and 50% because of RockFrontend.

RockPageBuilder adds something like this: rockfrontend()->styles()->addAll('/path/to/all/blocks');

This will tell RockFrontend to add all .less files to the main css file. You can tell it to rename this file, have a look here: https://www.baumrock.com/en/processwire/modules/rockfrontend/docs/asset-tools/

That means using the SCSS module it should also be possible to use ->addAll() and just place all .scss files in the block folders and let the module compile it to one file.

Do you understand what I'm trying to say? 😅

  • Like 1
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...