Skip to main content
Version: CANARY 🚧

Front-End Assets

Introduction​

Bow comes preconfigured with a modern Frontend environment based on Vite, including:

This setup provides instant reloading (HMR) and ultra-fast compilation.

Installation​

npm install

Commands​

CommandDescription
npm run devStarts the Vite development server with HMR
npm run buildCompiles and optimizes for production

Development​

npm run dev

Starts the Vite server with hot reloading. Changes are reflected instantly without reloading the page.

Production​

npm run build

Compiles and minifies the assets into the public/ folder.

File Structure​

assets/
β”œβ”€β”€ js/
β”‚ β”œβ”€β”€ app.js # Main entry point
β”‚ β”œβ”€β”€ Example.jsx # React component
β”‚ └── Example.vue # Vue component
β”œβ”€β”€ sass/
β”‚ β”œβ”€β”€ app.scss # Main styles
β”‚ └── variables.scss # SCSS variables
└── css/
└── app.css # CSS/Tailwind

Vite Configuration​

vite.config.js
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import react from '@vitejs/plugin-react';
import path from 'path';
import tailwindcss from '@tailwindcss/vite';

export default defineConfig({
plugins: [
vue(),
react(),
tailwindcss(),
],
root: path.resolve(__dirname, 'assets'),
build: {
outDir: path.resolve(__dirname, 'public'),
emptyOutDir: true,
rollupOptions: {
input: {
app: path.resolve(__dirname, 'assets/js/app.js'),
},
output: {
entryFileNames: 'js/[name].js',
assetFileNames: (assetInfo) => {
if (/\.(css|scss)$/.test(assetInfo.name)) {
return 'css/[name]-[hash][extname]';
}
if (/\.(png|jpe?g|gif|svg|webp)$/.test(assetInfo.name)) {
return 'img/[name]-[hash][extname]';
}
return '[ext]/[name]-[hash][extname]';
},
},
},
},