diff --git a/__tests__/fixtures/purge-example.html b/__tests__/fixtures/purge-example.html index 78132ef46..50ffdc3e1 100644 --- a/__tests__/fixtures/purge-example.html +++ b/__tests__/fixtures/purge-example.html @@ -3,7 +3,7 @@ My Page - +
diff --git a/__tests__/purgeUnusedStyles.test.js b/__tests__/purgeUnusedStyles.test.js index 118f21725..fa32b6ed4 100644 --- a/__tests__/purgeUnusedStyles.test.js +++ b/__tests__/purgeUnusedStyles.test.js @@ -80,6 +80,27 @@ test('purges unused classes', () => { }) }) +test('purges unused classes with important string', () => { + const OLD_NODE_ENV = process.env.NODE_ENV + process.env.NODE_ENV = 'production' + const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`) + const input = fs.readFileSync(inputPath, 'utf8') + + return postcss([ + tailwind({ + ...config, + important: '#tailwind', + purge: [path.resolve(`${__dirname}/fixtures/**/*.html`)], + }), + ]) + .process(input, { from: inputPath }) + .then(result => { + process.env.NODE_ENV = OLD_NODE_ENV + + assertPurged(result) + }) +}) + test('does not purge components', () => { const OLD_NODE_ENV = process.env.NODE_ENV process.env.NODE_ENV = 'production'