bem-refactor

Refactors Vue components to adopt the BEM naming convention and generates scoped CSS selectors.

7|1|Updated Mar 30, 2024
One-click install
npx skills add https://github.com/Lionad-Morotar/local-tools --skill bem-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bem-refactor
Source: https://github.com/Lionad-Morotar/local-tools/tree/main/local-link/skills/bem-refactor
Command: npx skills add https://github.com/Lionad-Morotar/local-tools --skill bem-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the process of refactoring Vue components to adhere to the BEM (Block-Element-Modifier) naming convention, improving code organization and maintainability.

Core Features & Use Cases

  • BEM Renaming: Automatically applies BEM class names to Vue component templates.
  • Style Block Generation: Creates corresponding nested BEM style blocks in the component's <style> section.
  • Tailwind Integration: Facilitates the combination of Tailwind utility classes with BEM semantic class names.
  • Use Case: When a user requests to "use useBEM to refactor this component" or "add BEM class names to this component," this Skill will perform the necessary code transformations.

Quick Start

Refactor the current Vue component to use the BEM naming convention with the block name 'page-saas'.

Frequently Asked Questions about bem-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Vue components to use BEM naming conventions?

To refactor Vue components with BEM, you can automate the transformation of existing class structures, introduce the `useBEM` composable, and generate corresponding scoped CSS BEM selectors for improved code organization.

Can I combine Tailwind utility classes with BEM semantic class names in Vue?

Yes, you can combine Tailwind utility classes with BEM semantic class names in Vue. This integration allows you to maintain semantic structure while leveraging utility-first styling within your component templates.

What is the useBEM composable used for in Vue component refactoring?

The `useBEM` composable is used during Vue component refactoring to programmatically generate and manage Block-Element-Modifier class names, ensuring consistent CSS methodology adoption across the template and style blocks.

How do I generate scoped CSS BEM style blocks for existing Vue components?

Generating scoped CSS BEM style blocks involves automatically applying BEM class names to the Vue component template and creating corresponding nested BEM style blocks within the component's `<style>` section.

Does this BEM refactoring approach work with Vue scoped CSS methodologies?

Yes, this BEM refactoring approach works with Vue scoped CSS methodologies by transforming existing class structures and generating nested BEM selectors specifically within the scoped style section of the component.

When should I refactor my Vue components to adopt the BEM methodology?

You should refactor Vue components to adopt the BEM methodology when you need to improve code structure, enhance maintainability, and ensure adherence to project-specific CSS methodologies for better code organization.