Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#932·webpack

Relative static assets in CSS folder

Author: rjooCreated Sep 20, 2017Updated Apr 20, 2020
Labelshelp wantedneed repro

Just opening a new issue confirming that bug #208 still exists and @githoniel's solution is still necessary today.

This has all to do with using relative paths in CSS files.

<style>
  .element {
    background-image: url('~./assets/img/bg.png');
    // works in dev
    // in production, browser will try to retrieve /static/css/assets/img/bg.png
  }
</style>

Source: vuejs-templates/webpack

View original on GitHubView discussion on GitHub