How to load an external CSS inside the builder & How to import classes via code?

Hello, I have my own utility classes that I want to use inside Bricks Builder, and I have two questions:

  1. Is there an API I can use so that I can import all my utility classes into Bricks via PHP code? Preferably they can be imported as ‘Locked’ selectors inside Bricks.

  2. How can I load this CSS file inside Bricks? Presumably it’s via PHP code as well. I don’t want to put a Code block inside every Bricks page in order to load this CSS file.

Thanks!

2 Likes

Since Bricks is a theme, you can just add your classes to the Bricks child theme style.css and functions.php files. Or, there are many options:
References: Child Theme – Bricks Academy
Custom Code – Bricks Academy

2 Likes

Hi, regarding to Q1 above, what I meant is, I already have a bunch of CSS classes located in wp-content/uploads/base-framework.css, which is a file I wrote myself. However I want to use these classes in Bricks. (I want to add these classes into Bricks so that I can filter and select them inside Bricks, but the styling rules are not set in Bricks, rather they are handwritten and enqueued inside Bricks editor).

I can extract the class names out of base-framework.css, and I hope Bricks has an API so that I can use PHP to load them into Bricks builder.

1 Like

Automatic CSS and Core Framework worked out to include external CSS Classes to the bricks global class list. So a way to do it is possible.

But I haven’t found the hooks in the PHP code of the bricks theme after a quick search.

If any of the core dev can give us a hint it will be great :slight_smile:

@zesenh

Why not use the custom code under settings?

Paste your entire CSS code in there and it’ll be accessible.