salesforce-ux / theo

Theo is a an abstraction for transforming and formatting Design Tokens
BSD 3-Clause "New" or "Revised" License
1.96k stars 117 forks source link

Something went wrong: Error: Invalid option "file": must be a path #264

Open prodtest375 opened 3 years ago

prodtest375 commented 3 years ago

`const express = require('express') const app = express() const port = 3000 const theo = require("theo");

var obj = {

props: [ { name: 'product-color', type:'color', value: '#ff0000', category :'font-color' }, { name: 'product-colorone', type:'color', value: 'rgb(1,2,3)', category :'font-color' } ] };

app.get('/', (req, res) => { theo.convert({ transform: { type: "web", //file: "collection.json", data : JSON.stringify(obj) }, format: { type: "less" } }) .then(scss => { console.log(scss); // $button-background: rgb(0, 112, 210); }) .catch(error => console.log(Something went wrong: ${error})); res.send('Hello World!') })

app.listen(port, () => { console.log(Example app listening at http://localhost:${port}) })` I need to format the javascript object to design tokens, above is my code , it shows error like "Something went wrong: Error: Invalid option "file": must be a path", It works fine when I created json file and give that path in file option. Any help appreciated.