• Introduction
    • Why Liquid
    • Getting started
    • CSS vs. Web Components
    • Component assets
    • Type checking and intellisense
    • Server-side rendering
    • Event handling
    • Form validation
    • React bindings
    • Tailwind CSS integration
    • Design tokens
    • Sandbox applications
    • FAQ
  • Globals
    • Animations
    • Border-radius
    • Colors
    • Focus
    • Fonts
    • Shadows
    • Spacings
    • Theming
    • Typography
  • Components
    • Accordion
      • Accordion Panel
      • Accordion Section
      • Accordion Toggle
    • Background Cells
    • Badge
    • Breadcrumbs
      • Crumb
    • Button
    • Card
    • Checkbox
    • Circular Progress
    • Header
    • Icon
    • Input
    • Input Message
    • Label
    • Link
    • Loading Indicator
    • Modal
    • Notice
    • Notification
    • Pagination
    • Progress
    • Radio Button
    • Screen Reader Live
    • Screen Reader Only
    • Select
      • Option
    • Sidenav
      • Sidenav Accordion
      • Sidenav Back
      • Sidenav Header
      • Sidenav Heading
      • Sidenav Navitem
      • Sidenav Separator
      • Sidenav Slider
      • Sidenav Subnav
      • Sidenav Toggle Outsid
    • Slider
    • Switch
      • Switch Item
    • Tabs
      • Tab
      • Tab List
      • Tab Panel
      • Tab Panel List
    • Toggle
    • Tooltip
    • Typography
  • Data Visualization
    • Getting Started
  1. Tweaking the bundler and adjusting the assets path
Introduction Component assets

Component assets #

Some Liquid Web Components include assets which need to be loaded during runtime. Depending on how you bundle your client side resources, you may need to tweak your bundler so that it puts Liquid's assets into the right place and "tell" Liquid where to look for the assets.

Tweaking the bundler and adjusting the assets path #

Suppose you have a Vue.js application which requires you to put all statically served assets into a folder called public in the root directory of your project. You can copy over all Liquid assets into that folder by tweeking the rollup config as follows:

// vite.config.js
import { defineConfig } from 'vite'
import copy from 'rollup-plugin-copy'

export default defineConfig({
plugins: [
copy({
targets: [
{
src: 'node_modules/@emdgroup-liquid/liquid/dist/liquid/assets/*',
dest: 'public/assets',
},
],
hook: 'buildStart',
}),
// ...
],
// ...
})

Now all you need to do is "tell" the Liquid components where they have to load their assets from by using setAssetPath:

// main.ts
import { setAssetPath } from '@emdgroup-liquid/liquid/dist/components'

setAssetPath(window.location.origin)
setAssetPath does not work for React bindings. Please take a look at the React bindings docs for an alternative approach.

For more examples check out our sandbox apps.