相关文章推荐
威武的葡萄酒  ·  VBA ...·  3 年前    · 
飘逸的饭卡  ·  Spring Cloud Stream ...·  3 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
<link rel="stylesheet" href="libs/owlcarousel/assets/owl.carousel.min.css">
<a href="/"><img src="img/logo.png" alt=""></a>
<link rel="stylesheet" href="{% static 'landing/libs/owlcarousel/assets/owl.carousel.min.css' %}">
<a href="/"><img src="{% static "landing/img/logo.png" %}" alt=""></a>

You can find and replace into the project with Ctrl + Shift + R.

Into the file selection, you can specify that you want to perform replacements in *.html files, and that we want to search for a regex (check the checkbox Regular expression).

As pattern, you can write a pattern like:

\b(src|href)="([^"]*)"\b

and as patttern to replace:

$1="{% static '$2' %}"

You might want to consider tweaking the pattern a bit, for example to only replace paths that start with libs/, etc.

this will then propose the changes. I advise you to look through these manually since there can be false positives: proposed changes, that should not change.

This pattern doesn't work for me in Pycharm 2020.1 Can you suggest an adjustment Willem? Would be a big help – Christopher Turnbull Jan 21, 2021 at 9:22

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.