Home Forums Basel support forum Remove unused CSS and Javascript on theme

Remove unused CSS and Javascript on theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #256179

    nikosvl97
    Participant

    Hello, i checked the unused css on my front page and i saw that a total of 94% of the css is unused
    the file is style.min.css.

    how can i remove the unused code ? if i make it manually on the css child it will keep it ?

    any suggestions ?

    #256353

    Artem Temos
    Keymaster

    Hello,

    Actually, if the code is unused on the front page it doesn’t mean that you can simply remove it. There are a lot of different elements and styles for pages that are not used on the front page but used on all other pages. That is why it is not possible simply to remove the CSS that you think is not needed on the home page since it will break other pages.

    Kind Regards

    #257193

    nikosvl97
    Participant

    i understand that. of course i will check all the pages that i am using. the question is if it will keep the changes if i am editing the file and save it in the child theme.

    #257240

    Artem Temos
    Keymaster

    In this case, you will need to dequeue the file and enqueue it in the child theme.
    https://developer.wordpress.org/reference/functions/wp_dequeue_style/

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)