Files
insertr/lib/rollup.config.js
Joakim 2346eea874 feat: add live preview system and enhance dev workflow
- Implement debounced live preview in modal editing (500ms)
- Add LivePreviewManager class with element tracking and restoration
- Enhance modal sizing for comfortable 60-80 character editing
- Add auto-copy plugin to rollup config for seamless development
- Update dev command to automatically sync changes to demo-site

The live preview system provides real-time visual feedback while typing in modals,
showing changes in context without saving. Enhanced dev workflow eliminates manual
build steps, enabling instant iteration during development.
2025-09-07 19:15:10 +02:00

47 lines
1013 B
JavaScript

import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import { execSync } from 'child_process';
// Simple copy plugin to auto-copy to demo-site during development
function copyToDemo() {
return {
name: 'copy-to-demo',
writeBundle() {
try {
execSync('cp dist/insertr.js ../demo-site/insertr.js');
console.log('📄 Copied to demo-site/insertr.js');
} catch (error) {
console.warn('⚠️ Failed to copy to demo-site:', error.message);
}
}
};
}
export default [
// Development build
{
input: 'src/index.js',
output: {
file: 'dist/insertr.js',
format: 'iife',
name: 'Insertr'
},
plugins: [
nodeResolve(),
copyToDemo()
]
},
// Production build (minified)
{
input: 'src/index.js',
output: {
file: 'dist/insertr.min.js',
format: 'iife',
name: 'Insertr'
},
plugins: [
nodeResolve(),
terser()
]
}
];