Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css modules的使用 #116

Open
mishe opened this issue Apr 25, 2016 · 0 comments
Open

css modules的使用 #116

mishe opened this issue Apr 25, 2016 · 0 comments

Comments

@mishe
Copy link
Owner

mishe commented Apr 25, 2016

今天看几篇css modules的介绍文章,特别是css modules的几种技术方案,在自己的小项目中赶紧体验了一把,采用了underscore模板

经过测试,文章中的使用方式存在2个问题,

  • underscore的如果是单独的文件,不能使用哪个方法,必须在引入模板的JS文件中引用css
  • ${..} 不是标准传参方式

另外有几个注意点

  • 引入css module 后,所有的css文件都要用css module 方式,不能混用,否则样式会有问题
  • 如果想要期中几个css文件不被css module编译,请配置exclude路径排除。
  • 所有css样式最好不要用上下层级关系,用独立的css命名
  • css命名建议采用驼峰命名方式
  • css选择器名称或层级关系不能有特殊符号,比如: - > < * / +等
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant