Add dependencies, fix warnings
This commit is contained in:
parent
6450748351
commit
bc05473b37
8 changed files with 1134 additions and 608 deletions
|
|
@ -2,7 +2,7 @@ import postcss from 'postcss'
|
|||
import plugin from '../src/lib/substituteClassApplyAtRules'
|
||||
|
||||
function run(input, opts = () => {}) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
return postcss([plugin(opts)]).process(input, { from: undefined })
|
||||
}
|
||||
|
||||
test("it copies a class's declarations into itself", () => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import postcss from 'postcss'
|
|||
import plugin from '../src/lib/evaluateTailwindFunctions'
|
||||
|
||||
function run(input, opts = {}) {
|
||||
return postcss([plugin(() => opts)]).process(input)
|
||||
return postcss([plugin(() => opts)]).process(input, { from: undefined })
|
||||
}
|
||||
|
||||
test('it looks up values in the config using dot notation', () => {
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ test('it uses the values from the custom config file', () => {
|
|||
return postcss([tailwind(path.resolve(`${__dirname}/fixtures/customConfig.js`))])
|
||||
.process(
|
||||
`
|
||||
@responsive {
|
||||
.foo {
|
||||
color: blue;
|
||||
@responsive {
|
||||
.foo {
|
||||
color: blue;
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
`,
|
||||
{ from: undefined }
|
||||
)
|
||||
.then(result => {
|
||||
const expected = `
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ import tailwind from '../src/index'
|
|||
* Tests
|
||||
*/
|
||||
it('generates the right CSS', () => {
|
||||
const input = fs.readFileSync(path.resolve(`${__dirname}/fixtures/tailwind-input.css`), 'utf8')
|
||||
const inputPath = path.resolve(`${__dirname}/fixtures/tailwind-input.css`)
|
||||
const input = fs.readFileSync(inputPath, 'utf8')
|
||||
|
||||
return postcss([tailwind()])
|
||||
.process(input)
|
||||
.process(input, { from: inputPath })
|
||||
.then(result => {
|
||||
const expected = fs.readFileSync(
|
||||
path.resolve(`${__dirname}/fixtures/tailwind-output.css`),
|
||||
|
|
@ -23,20 +24,20 @@ it('generates the right CSS', () => {
|
|||
|
||||
it('does not add any CSS if no Tailwind features are used', () => {
|
||||
return postcss([tailwind()])
|
||||
.process('.foo { color: blue; }')
|
||||
.process('.foo { color: blue; }', { from: undefined })
|
||||
.then(result => {
|
||||
expect(result.css).toMatchCss('.foo { color: blue; }')
|
||||
})
|
||||
})
|
||||
|
||||
it('generates the right CSS with implicit screen utilities', () => {
|
||||
const input = fs.readFileSync(
|
||||
path.resolve(`${__dirname}/fixtures/tailwind-input-with-explicit-screen-utilities.css`),
|
||||
'utf8'
|
||||
const inputPath = path.resolve(
|
||||
`${__dirname}/fixtures/tailwind-input-with-explicit-screen-utilities.css`
|
||||
)
|
||||
const input = fs.readFileSync(inputPath, 'utf8')
|
||||
|
||||
return postcss([tailwind()])
|
||||
.process(input)
|
||||
.process(input, { from: inputPath })
|
||||
.then(result => {
|
||||
const expected = fs.readFileSync(
|
||||
path.resolve(`${__dirname}/fixtures/tailwind-output-with-explicit-screen-utilities.css`),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import plugin from '../src/lib/substituteVariantsAtRules'
|
|||
import config from '../defaultConfig.stub.js'
|
||||
|
||||
function run(input, opts = () => config) {
|
||||
return postcss([plugin(opts)]).process(input)
|
||||
return postcss([plugin(opts)]).process(input, { from: undefined })
|
||||
}
|
||||
|
||||
test('it can generate hover variants', () => {
|
||||
|
|
|
|||
|
|
@ -38,19 +38,19 @@
|
|||
"eslint-config-prettier": "^2.7.0",
|
||||
"eslint-plugin-prettier": "^2.3.1",
|
||||
"jest": "^20.0.4",
|
||||
"mousetrap": "^1.6.1",
|
||||
"prettier": "^1.7.4",
|
||||
"rimraf": "^2.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^2.11.0",
|
||||
"cxs": "^6.2.0",
|
||||
"fs-extra": "^4.0.2",
|
||||
"lodash": "^4.17.4",
|
||||
"nodemon": "^1.11.0",
|
||||
"perfectionist": "^2.4.0",
|
||||
"postcss": "^6.0.9",
|
||||
"postcss-functions": "^3.0.0"
|
||||
"postcss-functions": "^3.0.0",
|
||||
"postcss-js": "^1.0.1",
|
||||
"postcss-nested": "^3.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function buildTailwind(inputFile, config, write) {
|
|||
const input = fs.readFileSync(inputFile, 'utf8')
|
||||
|
||||
return postcss([tailwind(config)])
|
||||
.process(input)
|
||||
.process(input, { from: inputFile })
|
||||
.then(result => {
|
||||
write(result.css)
|
||||
console.log('Finished building Tailwind!')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue