https://github.com/grapesjs/style-bg
Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients
https://github.com/grapesjs/style-bg
Last synced: about 1 year ago
JSON representation
Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients
- Host: GitHub
- URL: https://github.com/grapesjs/style-bg
- Owner: GrapesJS
- License: mit
- Created: 2020-03-20T00:03:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-12T11:22:52.000Z (about 3 years ago)
- Last Synced: 2025-04-12T04:51:41.723Z (about 1 year ago)
- Language: TypeScript
- Size: 356 KB
- Stars: 37
- Watchers: 4
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grapesjs Style Bg
Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients.
> Requires GrapesJS v0.20.1 or higher

[DEMO](https://codepen.io/artf/pen/GRGXdYe)
## Summary
* Plugin name: `grapesjs-style-bg`
* This plugin updates the built-in `background` style property.
## Options
| Option | Description | Default |
|-|-|-
| `styleGradientOpts` | Options for the `grapesjs-style-gradient` plugin | `{}` |
| `propExtender` | Extend single style property definition of the `background` property. | `prop => prop` |
## Download
* CDN
* `https://unpkg.com/grapesjs-style-bg`
* NPM
* `npm i grapesjs-style-bg`
* GIT
* `git clone https://github.com/GrapesJS/style-bg.git`
## Usage
Directly in the browser (remember to include the [Grapick](https://github.com/artf/grapick) CSS)
```html
var editor = grapesjs.init({
container: '#gjs',
// ...
plugins: ['grapesjs-style-bg'],
pluginsOpts: {
'grapesjs-style-bg': { /* options */ }
}
});
```
Modern javascript
```js
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-style-bg';
import 'grapesjs/dist/css/grapes.min.css';
import 'grapick/dist/grapick.min.css';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
```
## Development
Clone the repository
```sh
$ git clone https://github.com/GrapesJS/style-bg.git
$ cd grapesjs-style-bg
```
Install dependencies
```sh
$ npm i
```
Start the dev server
```sh
$ npm start
```
Build the source
```sh
$ npm run build
```
## License
MIT