swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.25k stars 744 forks source link

use custom svg icons by gulp #762

Open Klap-in opened 2 years ago

Klap-in commented 2 years ago

I try to use custom svg icons in the contextmenu. I try to understand how I could use this instruction (unfortunately I'm new to npm/node.js) https://swisnl.github.io/jQuery-contextMenu/docs/customize.html

In this issue I found the some practical steps: https://github.com/swisnl/jQuery-contextMenu/issues/492:

What icons are you using? Are you trying to add SVG icons? If so so the following (with npm installed ;))

Clone the repository Add the icons to ./src/icons/ Run npm install Run gulp css

(installed node with as snap on my Ubuntu 20.04 system sudo snap install node --classic --channel=16)

$ node --version
v16.15.0
$ npx --version
8.5.5
$ npm --version
8.5.5

npm install results in:

npm ERR! While resolving: jquery-contextmenu@2.9.2
npm ERR! Found: karma@5.0.2
npm ERR! node_modules/karma
npm ERR!   dev karma@"^5.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer karma@"^4.0.0" from karma-qunit@4.0.0
npm ERR! node_modules/karma-qunit
npm ERR!   dev karma-qunit@"^4.0.0" from the root project

After removing "karma-qunit": "^4.0.0", it makes more progress. karma-qunit latest version is 4.1.2, so I would guess it could be resolved, but I have no experience yet, so sure I overlooked the right bits.

After that it throws:

npm ERR! code 127
npm ERR! path /home/user/...<path>..../jQuery-contextMenu/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node build.js || nodejs build.js
npm ERR! sh: 1: nodejs: not found

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2022-05-22T13_49_40_095Z-debug-0.log

Probably this is more miss understanding of the npm tool, and not so much jQuery-contextmenu. But external pointers are welcome.

Also gulp build-icons does not deliver. It proposes yarn add gulp because no local gulp is found. Trying this, results in similar error and a lot of extra big amounts of logging of messages.. But as new user of these tools, I do not get the right gist from it.

splitbrain commented 2 years ago

Just a few thoughts:

The broken karma-qunit dependency looks like a bug to me. I think the dependencies need to be adjusted.

sh -c node build.js

This seems to be wrong, too. The repository does not contain any build.js file. It was probably dropped when moving to gulp.

Looking at the build-icons gulp task, it seems that it tries to build a custom icon font from the given SVG files. I wonder if it would be possible to use inline SVGs instead and thus not require a build process at all to customize the icons.