-
Notifications
You must be signed in to change notification settings - Fork 143
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
docs: erasing demo #306
docs: erasing demo #306
Conversation
for this to work the codepen needs to use a fabric build that has `erasing` option included
hi @ShaMan123 thanks for starting this. Here there is an explanation of how you can add an extra script to the codepen: https://blog.codepen.io/documentation/prefill-embeds/
We should find the eraser file here: https://unpkg.com/[email protected]/src/mixins/eraser_brush.mixin.js |
Demo looks nice so far! |
DONE |
i don't think so. the cdn is just a mirror of the npm package files
…On Sun, 6 Jun 2021 at 11:50, Shachar ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In _includes/codepen.html
<#306 (comment)>:
> @@ -1,5 +1,5 @@
<script type="text/javascript">
- var currentScript = ***@***.***/dist/fabric.js';
+ var currentScript = ***@***.***/dist/fabric.js';
BTW I was thinking of the CDN. Can it accept params?
***@***.***/dist/fabric.js?include=erasing
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#306 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJDQQCDDCCWSCJZBOYUKLLTRNAGDANCNFSM45V6FLXA>
.
|
What if the cdn will point to a file that appends scripts from the cdn? const include=querySearchParams.get('include').split(',')
if(include.indexOf('erasing') {
const script=docuemnt.createElement('script');
script.src='https://unpkg.com/fabric@latest/src/mixins/eraser_brush.mixin.js'
document.head.apprend(script)
} This is in essence a dynamic custom build |
This can work with npm as well, using resolve and baseUrl const include=querySearchParams.get('include').split(',') // this will need a different approach for node
const baseUrl = ENV==='node'? require.resolve('fabric') : 'https://unpkg.com/fabric@latest';
scripts = [];
if(include.indexOf('erasing') {
scripts.push(path.resolve(baseUrl,'/src/mixins/eraser_brush.mixin.js'))
}
scripts.map(path => {
if(ENV === 'node') {
require(path);
} else {
const script=docuemnt.createElement('script');
script.src= path;
document.head.apprend(script)
}
});
|
Hi @ShaMan123 sorry if i m being so late on this. I have not been able to do much lately. |
i ll merge it now, if then there is something to fix, we can fix it after. |
Adding DEMO for erasing
https://codepen.io/shaman123/pen/MWpEarw?editors=1010
For the codepen to work in the website the fabric build must include
erasing
.I have no idea how to do that.