forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5288ff
commit 371a79f
Showing
37 changed files
with
180 additions
and
92 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
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,83 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import _ from 'lodash' | ||
import postcss from 'postcss' | ||
import tailwind from '../src/index' | ||
import config from '../stubs/defaultConfig.stub.js' | ||
import processPlugins from '../src/util/processPlugins' | ||
|
||
function css(nodes) { | ||
return postcss.root({ nodes }).toString() | ||
} | ||
|
||
it('generates the right CSS in IE11 mode', () => { | ||
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`) | ||
const input = fs.readFileSync(inputPath, 'utf8') | ||
|
||
return postcss([tailwind({ ...config, target: 'ie11' })]) | ||
.process(input, { from: inputPath }) | ||
.then(result => { | ||
const expected = fs.readFileSync( | ||
path.resolve(`${__dirname}/fixtures/tailwind-output-ie11.css`), | ||
'utf8' | ||
) | ||
|
||
expect(result.css).toBe(expected) | ||
}) | ||
}) | ||
|
||
test('plugins can request the target for a specific plugin key', () => { | ||
const { utilities } = processPlugins( | ||
[ | ||
function({ addUtilities, target }) { | ||
addUtilities({ | ||
'.testA': { | ||
target: target('testPluginA'), | ||
}, | ||
}) | ||
}, | ||
function({ addUtilities, target }) { | ||
addUtilities({ | ||
'.testB': { | ||
target: target('testPluginB'), | ||
}, | ||
}) | ||
}, | ||
function({ addUtilities, target }) { | ||
addUtilities({ | ||
'.testC': { | ||
target: target('testPluginC'), | ||
}, | ||
}) | ||
}, | ||
], | ||
{ | ||
...config, | ||
target: [ | ||
'ie11', | ||
{ | ||
testPluginA: 'modern', | ||
testPluginB: 'relaxed', | ||
}, | ||
], | ||
} | ||
) | ||
|
||
expect(css(utilities)).toMatchCss(` | ||
@variants { | ||
.testA { | ||
target: modern | ||
} | ||
} | ||
@variants { | ||
.testB { | ||
target: relaxed | ||
} | ||
} | ||
@variants { | ||
.testC { | ||
target: ie11 | ||
} | ||
} | ||
`) | ||
}) |
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
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
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gap') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gap', [ | ||
['gap', ['gridGap', 'gap']], | ||
['col-gap', ['gridColumnGap', 'columnGap']], | ||
['row-gap', ['gridRowGap', 'rowGap']], | ||
])({ config, ...args }) | ||
])({ target, ...args }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gridColumn') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gridColumn', [['col', ['gridColumn']]])({ config, ...args }) | ||
createUtilityPlugin('gridColumn', [['col', ['gridColumn']]])({ target, ...args }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gridColumnEnd') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gridColumnEnd', [['col-end', ['gridColumnEnd']]])({ config, ...args }) | ||
createUtilityPlugin('gridColumnEnd', [['col-end', ['gridColumnEnd']]])({ target, ...args }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gridRow') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gridRow', [['row', ['gridRow']]])({ config, ...args }) | ||
createUtilityPlugin('gridRow', [['row', ['gridRow']]])({ target, ...args }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gridRowEnd') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gridRowEnd', [['row-end', ['gridRowEnd']]])({ config, ...args }) | ||
createUtilityPlugin('gridRowEnd', [['row-end', ['gridRowEnd']]])({ target, ...args }) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import createUtilityPlugin from '../util/createUtilityPlugin' | ||
|
||
export default function() { | ||
return function({ config, ...args }) { | ||
if (config('target') === 'ie11') { | ||
return function({ target, ...args }) { | ||
if (target('gridRowStart') === 'ie11') { | ||
return | ||
} | ||
|
||
createUtilityPlugin('gridRowStart', [['row-start', ['gridRowStart']]])({ config, ...args }) | ||
createUtilityPlugin('gridRowStart', [['row-start', ['gridRowStart']]])({ target, ...args }) | ||
} | ||
} |
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
Oops, something went wrong.