Eddie's Blog

[vuejs] Kebab Case, Camel Case, Snake Case 본문

programmings

[vuejs] Kebab Case, Camel Case, Snake Case

eddie.y 2018. 3. 11. 23:16

Vue.js 2.x의 공식 가이드를 살펴보면 Vue.component 의 이름을 케밥 케이스(kebab-case)를 사용하고 있는데, 가이드 문서 중에 아래와 안내 문구를 발견할 수 있다.


Note that Vue does not enforce the W3C rules for custom tag names (all-lowercase, must contain a hyphen) though following this convention is considered good practice.
Vue는 W3C 규칙(모두 소문자와 하이픈만을 허용)을 강요하지 않습니다. 하지만 이런 규약이 좋은 습관이라고 생각합니다.


하지만, Vue.component의 이름을 카멜 케이스(camelCase: 원래 발음은 캐믈이라고 해야 한다.) 형태로 작성하면 다음과 같은 경고 문구를 만나게 된다.

[Vue warn]: Unknown custom element: <simpcomp> - did you register the component correctly? For recursive components, make sure to provide the "name" option.


강요하지 않는다고 하지만 경고와 함께 실행조차 되지 않는다. 물론 스네이크 케이스(snake_case)도 허용하지만, W3C 규칙을 따라 작성하는 것이 좋은 습관(?)이 될 것 같다.

Comments