File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,29 @@ posthtml([require('posthtml-css-modules')('./cssModules/')])
7575// <div class="baseWrapper _profile_user_f93j">John</div>
7676// <h2 class="_article__tile _heading"></h2>
7777```
78+
79+
80+ ### Object
81+ You can also pass CSS modules as an object to the plugin:
82+ ```
83+ var posthtml = require('posthtml'),
84+ cssModules = {
85+ title: "_title_116zl_1 _heading_9dkf",
86+ profile: {
87+ user: "_profile_user_f93j"
88+ }
89+ };
90+
91+ posthtml([require('posthtml-css-modules')(cssModules)])
92+ .process(
93+ '<h1 css-module="title">My profile</h1>' +
94+ // You can also use nested modules
95+ '<div css-module="profile.user">John</div>'
96+ )
97+ .then(function (result) {
98+ console.log(result.html);
99+ });
100+
101+ // <h1 class="_title_116zl_1 _heading_9dkf">My profile</h1>
102+ // <div class="_profile_user_f93j">John</div>
103+ ```
You can’t perform that action at this time.
0 commit comments