diff --git a/__tests__/themeFunction.test.js b/__tests__/themeFunction.test.js index 70e889888..6b777da87 100644 --- a/__tests__/themeFunction.test.js +++ b/__tests__/themeFunction.test.js @@ -88,3 +88,24 @@ test('quotes are preserved around default values', () => { expect(result.warnings().length).toBe(0) }) }) + +test('an unquoted list is valid as a default value', () => { + const input = ` + .heading { font-family: theme('fonts.sans', Helvetica, Arial, sans-serif); } + ` + + const output = ` + .heading { font-family: Helvetica, Arial, sans-serif; } + ` + + return run(input, { + theme: { + fonts: { + serif: 'Constantia', + }, + }, + }).then(result => { + expect(result.css).toEqual(output) + expect(result.warnings().length).toBe(0) + }) +}) diff --git a/src/lib/evaluateTailwindFunctions.js b/src/lib/evaluateTailwindFunctions.js index 7e08033b3..a1d3a4329 100644 --- a/src/lib/evaluateTailwindFunctions.js +++ b/src/lib/evaluateTailwindFunctions.js @@ -4,8 +4,8 @@ import functions from 'postcss-functions' export default function(config) { return functions({ functions: { - theme: (path, defaultValue) => { - return _.get(config.theme, _.trim(path, `'"`), defaultValue) + theme: (path, ...defaultValue) => { + return _.get(config.theme, _.trim(path, `'"`), defaultValue.join(', ')) }, }, })