Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(classic UI): how to get a minimal barceloneta integration #1592

Merged
merged 11 commits into from
Mar 17, 2024
58 changes: 57 additions & 1 deletion docs/classic-ui/theming/from-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ prefix = /++theme++plonetheme.munich
doctype = <!DOCTYPE html>
```

(classic-ui-from-scratch-bundle-registration-label)=

### Bundle registration

```xml
Expand Down Expand Up @@ -120,7 +122,61 @@ yarn dist
- Tweak basic settings like rounded corners, shadows, and so on.
- Set custom fonts
- Define your own stuff
- Import Boostrap (as basis)
- Import Bootstrap (as basis)


#### Minimal backend styling

When you create a theme from scratch, it is convenient to reuse the Barceloneta theme for:

- Plone toolbar
- add and edit forms
- control panels

To do so, follow this guide.

- Create a new CSS file in your theme, such as the following.

```scss
import "@plone/plonetheme-barceloneta-base/scss/variables.colors.plone";
import "@plone/plonetheme-barceloneta-base/scss/variables.colors.dark.plone";
import "@plone/plonetheme-barceloneta-base/scss/root_variables";
import "bootstrap/scss/bootstrap";
gforcada marked this conversation as resolved.
Show resolved Hide resolved

@import "@plone/plonetheme-barceloneta-base/scss/toolbar";
@import "@plone/plonetheme-barceloneta-base/scss/controlpanels";
@import "@plone/plonetheme-barceloneta-base/scss/forms";
```

```{tip}
See all the available [Barceloneta SCSS files](https://github.com/plone/plonetheme.barceloneta/tree/master/scss), and import the ones that you want to use.
```

- Add `@plone/plonetheme-barceloneta-base` as a dependency.

```shell
yarn add @plone/plonetheme-barceloneta-base
```

- Add a script in {file}`package.json` to compile the CSS.

```json
"css-compile-main": "sass --load-path=node_modules --style expanded --source-map --embed-sources --no-error-css plone.scss:../static/plone.css"
```

```{tip}
Look at [`plonetheme.barcelonta`'s {file}`package.json`](https://github.com/plone/plonetheme.barceloneta/blob/master/package.json) for a few more scripts that can prefix and minify your CSS and get a bundle for use in production.
```

- Run the compilation.

```shell
yarn run css-compile-main
```

- Finally, {ref}`register the bundle <classic-ui-from-scratch-bundle-registration-label>`.

With this guide, you will save yourself quite some work on styling the toolbar, the add and edit forms, and control panels, while keeping the rest of your theming separate.


#### Templates
Expand Down
Loading