-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement JSON converter (#51)
- Loading branch information
1 parent
eea9fb3
commit 554213e
Showing
6 changed files
with
2,372 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Converter from './Converter' | ||
|
||
class JSONConverter extends Converter { | ||
format = 'json' | ||
|
||
convert () { | ||
const filtered = Object.entries(this.theme).filter(([key]) => { | ||
return this._isSettingEnabled(key) | ||
}) | ||
|
||
return JSON.stringify(Object.fromEntries(filtered), null, 2) | ||
} | ||
} | ||
|
||
export default JSONConverter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import JSONConverter from '../../../src/converters/JSON' | ||
import { resolveConfig } from '../../../src/converters/utils' | ||
import testConfigDefault from '../../tailwind-default.config' | ||
|
||
describe('JSON converter', () => { | ||
describe('full config', () => { | ||
it('converts all props, to a JSON', () => { | ||
const converter = new JSONConverter({ | ||
config: resolveConfig(testConfigDefault) | ||
}) | ||
expect(converter.convert()).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.