mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.33k stars 1.15k forks source link

Chart.js style is injected into site header regardless of deleting the chart.js library #277

Open ni-fara opened 4 years ago

ni-fara commented 4 years ago

After customizing MDB Free using Gulp and removing the line related to Chart.js component in \MDB Gulp Free\js\modules.js, mdb.js file still contains some code that injects the style below into site header.

<style type="text/css"> /* Chart.js */ @-webkit-keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}@keyframes chartjs-render-animation{from{opacity:0.99}to{opacity:1}}.chartjs-render-monitor{-webkit-animation:chartjs-render-animation 0.001s;animation:chartjs-render-animation 0.001s;} </style>

The function that injects the style is:

function injectCSS(platform, css) {
    // http://stackoverflow.com/q/3922139
    var style = platform._style || document.createElement('style');
    if (!platform._style) {
        platform._style = style;
        css = '/* Chart.js */\n' + css;
        style.setAttribute('type', 'text/css');
        document.getElementsByTagName('head')[0].appendChild(style);
    }

    style.appendChild(document.createTextNode(css));
}
ashish-hacker commented 4 years ago

can anyone descrbe what's the issue?

gbujanski commented 4 years ago

Hi. Try run 3 commands: npm run js-compile-plugins, npm run js-build' andnpm run js-minify`. And check again. This should compile js again and delete chart.js code from mdb.js.

ni-fara commented 4 years ago

Hi. Try run 3 commands: npm run js-compile-plugins, npm run js-build' andnpm run js-minify`. And check again. This should compile js again and delete chart.js code from mdb.js.

Thanks @gbujanski , the extra code is deleted. But actually after deleting the line related to Chart.js in \MDB Gulp Free\js\modules.js and saving the file, the MDBootstrap gulp package automatically compiles new mdb.js and mdb.js.css files and deletes main chart.js code from them. Shouldn't it delete that extra code too?

mateuszlubianka1993 commented 4 years ago

Hi @ni-fara ,

I'll create a task with this case and our team will check it and give you response.

Best,