diff --git a/index.js b/index.js index 17d1624..b3d5c1d 100644 --- a/index.js +++ b/index.js @@ -424,8 +424,10 @@ export function format(css, { minify = false } = {}) { value += SPACE } - if (node.important) { + if (node.important === true) { value += OPTIONAL_SPACE + '!important' + } else if (typeof node.important === 'string') { + value += OPTIONAL_SPACE + '!' + lowercase(node.important) } return indent(indent_level) + property + COLON + OPTIONAL_SPACE + value diff --git a/test/declarations.test.js b/test/declarations.test.js index d987dab..3e9cd6d 100644 --- a/test/declarations.test.js +++ b/test/declarations.test.js @@ -89,4 +89,20 @@ test('!important is lowercase', () => { assert.is(actual, expected) }) +test('browserhack !ie is printed', () => { + let actual = format(`a { color: green !ie}`) + let expected = `a { + color: green !ie; +}` + assert.is(actual, expected) +}) + +test('browserhack !IE is lowercased', () => { + let actual = format(`a { color: green !IE}`) + let expected = `a { + color: green !ie; +}` + assert.is(actual, expected) +}) + test.run()