Jordan Pittman bf44941049
Allow resolving content paths relative to the config file (#9396)
* Update lockfile

* Tweak formatting

* Refactor content path parsing

* Allow resolving content paths relative to the config file

* Include resolved symlinks as additional content paths

* Update changelog

* Work on suite of tests for content resolution

* reformat integration test list

* Move content resolution tests to integration

* Update future and experimental types
2022-09-23 08:09:02 -04:00

54 lines
1.1 KiB
JavaScript

// @ts-config
let fs = require('fs')
let path = require('path')
module.exports.writeConfigs = async function writeConfigs({
both = {},
inRoot = {},
inDir = {},
} = {}) {
let configs = [
{
path: '../tailwind.config.js',
config: {
...both,
...inRoot,
content: {
files: [],
...both.content,
...inRoot.content,
},
},
},
{
path: '../src/tailwind.config.js',
config: {
...both,
...inDir,
content: {
files: [],
...both.content,
...inDir.content,
},
},
},
]
let defaultConfig = {
corePlugins: { preflight: false },
}
for (const config of configs) {
await fs.promises.writeFile(
path.resolve(__dirname, config.path),
`module.exports = ${JSON.stringify({ ...defaultConfig, ...config.config })};`
)
}
}
module.exports.destroyConfigs = async function destroyConfigs() {
await fs.promises.unlink(path.resolve(__dirname, '../tailwind.config.js'))
await fs.promises.unlink(path.resolve(__dirname, '../src/tailwind.config.js'))
}