You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,50 @@ It will yield the following object:
86
86
}
87
87
```
88
88
89
+
## Right on! But I need options.
90
+
91
+
Everybody loves options and we've got one:
92
+
93
+
Option Name | Default | Description
94
+
:---------- | :------ | :----------
95
+
`camelCase` | true | Should SASS variable names be converted to camelCase
96
+
97
+
### Options Usage
98
+
99
+
#### Plugin Instance
100
+
101
+
Currently there is no way to pass plugin options through sass-extract's render or extract api. However, you *can* pass a plugin instance directly inside the plugins array instead of a string. Here's how to do it:
// Call the `renderSync` function with the path to your Sass file
111
+
// and pass the plugin instance in the plugins array
112
+
constrendered=sassExtract.renderSync({
113
+
file:'./path/to/vars.scss'
114
+
}, {
115
+
plugins: [sassExtractJsPlugin]
116
+
});
117
+
118
+
```
119
+
120
+
#### Using `transformVars` directly
121
+
122
+
If, for some reason, you don't want to use this package as a sass-extract plugin, you can import the `transformVars` function directly and use it. This is the main function that gets called in sass-extract's plugin pipeline. It expects as its input an object with extracted SASS variables, as generated by sass-extract. The function also accepts an options object.
No problem! I made this so I could use the extracted JS object as a theme but it's not specific to [styled-components][styled-components]. It should work the same with [glamorous][glamorous] too. Really you can use this plugin for any scenario where you need to convert Sass vars to JS.
@@ -94,6 +138,10 @@ No problem! I made this so I could use the extracted JS object as a theme but it
94
138
95
139
This project is open source. I've tried to make sure it works for a lot of use cases (read: mine) but if I missed yours, feel free to [open an issue][issues]. Better yet, [submit a PR][pr]! Seriously, any feedback and help is welcome.
0 commit comments