EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 281 forks source link

Handling assets #33

Closed adamk22 closed 5 years ago

adamk22 commented 5 years ago

Hi @EvanAgee, first, thank you for the work! So far I've made it to good use but I'm wondering about how to handle assets, namely static images that sit in the dist folder.

I do have a solution which works, which is making a global variable to the directory and use it for static images in my template like so:

Vue.prototype.$ASSET_DIR = "/wp-content/themes/theme-name/dist";

and in my template `

`

However, there must be a better way? Is there an asset handling provided by webpack that I'm missing here?

EvanAgee commented 5 years ago

Hey @adamk22 I think that's a perfectly fine solution! I've been doing some very similar myself!