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

Documentation: how to create custom bundles? #1361

Open
gforcada opened this issue Dec 27, 2023 · 2 comments
Open

Documentation: how to create custom bundles? #1361

gforcada opened this issue Dec 27, 2023 · 2 comments

Comments

@gforcada
Copy link
Sponsor Member

Is there any documentation/guide on how to create a custom bundle of Mockup?

Use case: we have a few heavily customized TinyMCE configurations that are applied depending on the text field (main text gets full TinyMCE toolbar, but comments or author biographies get a slimmer TinyMCE toolbar), and thus, we need Mockup to do all the other stuff, but not for TinyMCE.

So, it's a counterpart of plone/documentation#1592 but for JS 😄

My approach so far (within the last 3 hours 😅 ):

  • git clone mockup
  • npx yarn
  • npx yarn start:webpack
  • comment out right and left at src/patterns.js
  • replace the bundle URL on the resource registry control panel to point to http://localhost:8000/bundle.min.js

btw. the hot reloading of start:webpack and that the browser itself also reloads is great!! 🌟

Now, a few questions:

  • is that a good approach?
  • what would be steps to actually deploy these modifications to production?
    • i.e. run some npx yarn build:webpack, and copy&paste the dist/* files into a distribution that has a <plone:static folder and make a release of it? 🤔

Like on plone/documentation#1592 I'm willing to create a PR either here or in documentation to mention these steps, so anyone that tries to do the same finds the documentation for it ✨

@yurj
Copy link
Contributor

yurj commented Dec 31, 2023

you've to rebuild plone.staticresources via mockup

https://github.com/plone/plone.staticresources#how-to-upgrade-the-resources-in-this-package

"Changes to JavaScript functionality must be done outside this package. If you want to fix something or add functionality please go to the mockup repository and follow the instructions there. This package is only to deliver the generated bundles"

@petschki
Copy link
Member

petschki commented Jan 2, 2024

Instead of tweaking the whole mockup package my approach for this would be to override pat-tinymce with my own code like described here: https://community.plone.org/t/plone-6-overriding-plone-mockup-upload-pattern-practical-example/18157/4?u=petschki ... simply create a pattern (with plonecli) which has the same name pat-tinymce and remove the original registration before re-using the code in your pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants