用于CSS模块的Emmet-Atom自定义代码段

时间:2016-06-28 02:05:45

标签: css reactjs code-snippets atom-editor emmet

我正在使用带有ReactJs(jsx)的CSS模块。有没有办法在Emmet或Atom中创建自定义代码段以使用CSS模块而不是常规类?

示例,目前Emmet的工作原理如下: .title扩展为<div className="title"></div>

我希望能够创建类似于以下内容的代码段: .styles-title扩展为<div className={styles.title}></div>

1 个答案:

答案 0 :(得分:2)

This actually turned out to be rather tricky. Emmet and the Atom extension both allow for customization, but a security policy in Atom does not allow loading custom filters from outside the extension.

With some nudging in the right direction (see the GitHub issue linked above) I was able to write my own Atom extension that does this.