mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Support passing config as a path
Let's you do tailwind('config.js') instead of
tailwind(require('config.js')) when registering Tailwind as a PostCSS
plugin.
This commit is contained in:
parent
70cabb00c4
commit
18f4e650bd
@ -15,6 +15,6 @@ const tailwind = require('./../lib/index.js');
|
||||
mix.less('source/_assets/less/main.less', 'source/css')
|
||||
.options({
|
||||
postCss: [
|
||||
tailwind(require('./tailwind.js')),
|
||||
tailwind('tailwind.js'),
|
||||
]
|
||||
})
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import _ from 'lodash'
|
||||
import postcss from 'postcss'
|
||||
import stylefmt from 'stylefmt'
|
||||
@ -15,6 +17,10 @@ import substituteScreenAtRules from './lib/substituteScreenAtRules'
|
||||
import substituteClassApplyAtRules from './lib/substituteClassApplyAtRules'
|
||||
|
||||
const plugin = postcss.plugin('tailwind', (options = {}) => {
|
||||
if (_.isString(options)) {
|
||||
options = require(path.resolve(options))
|
||||
}
|
||||
|
||||
const config = mergeConfig(defaultConfig, options)
|
||||
|
||||
return postcss([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user