JS and CSS image path Do I need to hardcode the image path to JavaScript and CSS files?

#mydiv { background: url(http://example.org/themes/mytheme/image/bg.png); }


I cannot use {{ base_path }}/image/bg.png in .js and .css files, which works in a template file.

Is there better way than hard-coding?
If I understand correct, no need to hardcode images: Add any image through the Drupal program itself via the API or background images via the css and a relative path:

For example, if your image is at theme/images, do {background: url(images/image.png);} or {background: url(../images/image.png);} if your css is situated in a folder of it's own inside the theme's folder.

You could filter or manipulate specific images with JS globally via a custom js file for your site as explained here.