3

I'm building a theme based on the Blank theme, using the Magento UI library.

I notice that Magento comes with a color picker, which loads both spectrum.js (> 80 kB) and tinycolor.js (almost 40 kB). To be fair, these sizes are before minimizing the code, nevertheless this is still a massive amount of JavaScript, especially since my site doesn't have any use for a color picker in the first place.

Is there any way to remove / disable the color picker, such that I can avoid loading this unnecessary code?

3
  • do you want to remove those JS from front-end ?
    – Pawan
    Jul 19, 2020 at 13:49
  • @Pawan Yes, exactly. Why load JS that is not needed?
    – m4r73n
    Jul 19, 2020 at 17:49
  • Hi @m4r73n Do you get the solution?
    – faizanbeg
    Sep 24, 2020 at 7:38

3 Answers 3

2

You can override bootstrap to remove color-picker.

Create a folder in theme with name Magento_Ui and override bootstrap.js file and remove below code

colorPicker: require('./color-picker')

1

did you ever find how to disable these useless scripts?? who the hell decided its good idea to force people to use all ui modules from jquery, I mean this is 50iq play

1
  • No, unfortunately I haven't.
    – m4r73n
    Oct 25, 2020 at 11:07
0

This totally resurecting an old thread but just had to do the exact same thing and found that you can accomplish this by overriding:

vendor/magento/module-ui/view/base/web/js/lib/knockout/bindings/bootstrap.js

And then removing the librarys not required from there

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.