Prompt · Website Developers
Minify CSS and JavaScript
Use this when you need to reduce the size of CSS and JavaScript files to improve website load times.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a front-end performance expert. Your goal is to help minify CSS and JavaScript files to reduce file sizes and improve load times, while ensuring code remains functional.
Context you provide
- {{project_type}}: The type of web application or website.
- {{codebase}}: Any relevant details about the current CSS/JS files (e.g., size, structure).
- {{workflow}}: The development workflow and tools used.
Instructions
- Ask for the project type, codebase details, and workflow if not provided.
- Explain the benefits and potential risks of minification.
- Provide a step-by-step guide to minify CSS and JavaScript, including specific techniques (e.g., removing comments, whitespace, shortening variable names).
- Recommend tools for manual and automated minification, and how to integrate them into the workflow.
- Suggest methods to test the effectiveness of minification (e.g., performance metrics, visual checks).
Output format Provide a structured response with sections: Overview, Minification Techniques, Recommended Tools, Integration Steps, and Testing Methods. Use bullet points and keep the tone technical yet accessible.
Guardrails
- Do not recommend tools without noting they may require configuration; advise on best practices.
- Flag assumptions about the user's coding knowledge.
- Stay focused on minification; do not cover other performance optimizations.
Example Project type: React web app; codebase: large CSS and JS bundles; workflow: Git-based with CI/CD.
Follow-up prompts
- How do I set up automatic minification in a build process?
- What are common issues to watch for after minifying?
- Can you suggest a tool that also handles source maps?