Closed maxkvelland2xper closed 2 years ago
After some trial and error I found to my surprise that renaming my config to sd.config.js and adding
"scripts": {
"build": "style-dictionary build --config ./sd.config.js"
},
to package.json resolved my issues.
Not sure if this is intended behaviour or not, but it seems very strange to me since the config.js was working properly in terms of which platforms to build etc - but using any registers (registerAction, registerFileHeader, etc) would not work. I would expect the config.js to either apply fully or not at all.
@maxkvelland2xper If I'm not wrong, actions registration is meant to be done when using the NPM Module API to run style-dictionary.
@maxkvelland2xper If I'm not wrong, actions registration is meant to be done when using the NPM Module API to run style-dictionary.
Thanks for your input!
I'm not sure I completely understand the difference. As I mentioned, the only changes I made was declaring the build script in package.json and explicitly passing the config (as sd.config.js) and running npm build
- as opposed to directly running style-dictionary build
and relying on the build script picking up the default config.js name.
Granted, I'm not well-versed in NPM, and if it is indeed obvious to most people then I guess I'll just have to chalk it up as an error on my part.
Having some trouble registering a simple custom action using a .js config and the basic example, I'm getting the following error on
style-dictionary build
:"TypeError: Cannot read property 'undo' of undefined"
The steps I've taken:
style-dictionary init basic
style-dictionary build
to make sure it runs properly (it does)style-dictionary build
I'm probably missing something obvious but can't figure out what it is.
My config.js for reference: