# FYI custom code block for grapesjs works good so far - instructions to add

**URL:** <https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956>\
**Category:** Development\
**Created:** [September 21, 2021, 4:40pm UTC](https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956 "2021-09-21T16:40:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henryweismann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/henryweismann/32/3125_2.png) [@henryweismann](https://forum.mautic.org/u/henryweismann)\
**Post date:** [September 21, 2021, 4:40pm UTC](https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956/1 "2021-09-21T16:40:57Z")

</div>

> **[GitHub - artf/grapesjs-custom-code: GrapesJS component for the embed of...](https://github.com/artf/grapesjs-custom-code)**
>
> GrapesJS component for the embed of custom code . Contribute to artf/grapesjs-custom-code development by creating an account on GitHub.

In grapesjs plugin dir:

`npm i grapesjs-custom-code`

then  
here

> <https://github.com/mautic/mautic/blob/567ea2c251b7cb075b78c54059b86c0153ea651f/plugins/GrapesJsBuilderBundle/Assets/library/js/builder.service.js>

add

`import grapesjscustomcode from 'grapesjs-custom-code';`

on line 10

then in each

`this.editor = grapesjs.init({`

add to plugins

like  
`plugins: [grapesjswebpage, grapesjspostcss, grapesjsmautic, 'gjs-plugin-ckeditor',grapesjscustomcode],`

Then build:  
`npm run build`

It should be fine for all types of editors ie webpage, htmlemail and i think mjml

Works like a charm!

---

<div class="post-metadata">

**Author:** ![Jorgeh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jorgeh/32/131_2.png) [@Jorgeh](https://forum.mautic.org/u/Jorgeh)\
**Post date:** [January 25, 2022, 10:30am UTC](https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956/2 "2022-01-25T10:30:05Z")

</div>

Hello, thanks for the details…  
I am getting this error, could you help me with it please?

 ![error](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/8/8de4da00e21ecfad968348433f448c9690872757.jpeg)  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![abdulwahab](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/abdulwahab/32/505_2.png) [@abdulwahab](https://forum.mautic.org/u/abdulwahab)\
**Post date:** [July 27, 2022, 2:20pm UTC](https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956/3 "2022-07-27T14:20:49Z")

</div>

> [@henryweismann](#):
>
> npm run build

I am getting errors on “npm run build”. Can you please tell me where I should run this command? I mean in which directory?

---

<div class="post-metadata">

**Author:** ![abdulwahab](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/abdulwahab/32/505_2.png) [@abdulwahab](https://forum.mautic.org/u/abdulwahab)\
**Post date:** [August 1, 2022, 8:51am UTC](https://forum.mautic.org/t/fyi-custom-code-block-for-grapesjs-works-good-so-far-instructions-to-add/20956/4 "2022-08-01T08:51:25Z")

</div>

> [@henryweismann](#):
>
> npm run build

@henryweismann it didnot work on npm run build. Where should I run it ? Thanks.
