1

I'm developing a website and I want to remove unused stylesheet links and JavaScript scripts from my HTML pages to make the page load faster.

I'm using PhpStorm and it would be really grateful if someone could help me with this.

3
  • PhpStorm does not have such functionality. Plus ... your code might load additional resources vis Ajax requests or alike .. so unused in static page code (JS or CSS) might be used later at some stage. Therefore such analysis might be completely wrong. Better use some 3rd party tools for such stuff. Commented May 4, 2017 at 23:29
  • @LazyOne yes,sure. Can you recommend me any 3rd party tool which I canbe used for this. Commented May 5, 2017 at 0:54
  • @s0rfi949 What's the point of posting code in this context? Commented May 5, 2017 at 12:17

2 Answers 2

1

For css you can use: https://unused-css.com/ For js you can use: https://marketplace.visualstudio.com/items?itemName=RobertHoffmann.FindUnusedFiles

Sign up to request clarification or add additional context in comments.

Comments

1

unused-css is using a headless browser to generate its report. If your site is using JavaScript to generate content based on user actions, it will not work correctly.

Tools like https://www.bleachcss.com/ or https://github.com/purifycss/purifycss are much better to handle this case.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.