Skip to content

16th May 2022

Coding

  • New: Get assets url.

    If you're using Vite, you can save the assets such as images or audios in the src/assets directory, and you can get the url with:

    getImage() {
      return new URL(`../assets/pictures/${this.active_id}.jpg`, import.meta.url).href
    },
    

    This way it will give you the correct url whether you're in the development environment or in production.

  • New: Play audio files.

    You can get the file and save it into a data element with:

    getAudio() {
      this.audio = new Audio(new URL(`../assets/audio/${this.active_id}.mp3`, import.meta.url).href)
    },
    

    You can start playing with this.audio.play(), and stop with this.audio.pause().

  • New: Vue Router.

    Creating a Single-page Application with Vue + Vue Router feels natural, all we need to do is map our components to the routes and let Vue Router know where to render them.

  • New: Deploy static site on github pages.

Operating Systems

Linux

Linux Snippets