tailwindcss/src/jit/index.js
Robin Malfait 4528bdc2d8
Start of new CLI (#4526)
* Ignore workspace settings

* Parameterize setting up the context

* WIP

* WIP

* WIP

* WIP

* wip

* WIP

Co-Authored-By: Jesse Katsumata <niconico.clarinet@gmail.com>

* WIP

Co-Authored-By: Jesse Katsumata <niconico.clarinet@gmail.com>

* WIP

Co-Authored-By: Jesse Katsumata <niconico.clarinet@gmail.com>

* Update some comments

Co-Authored-By: Jesse Katsumata <niconico.clarinet@gmail.com>

* Fix bug

* WIP

* WIP'

* more things

* log console.time calls conditionally based on process.env.DEBUG

* add `init` command

* clean up when using --jit

* Make config file optional

* cleanup path.resolve calls

path.resolve('.') is the same as path.resolve(process.cwd(), '.')

* implement `--help`

* shush eslint

* drop unnecessary file

Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
Co-authored-by: Jesse Katsumata <niconico.clarinet@gmail.com>
2021-06-01 14:02:23 +02:00

29 lines
824 B
JavaScript

import setupTrackingContext from './lib/setupTrackingContext'
import setupWatchingContext from './lib/setupWatchingContext'
import { env } from './lib/sharedState'
import processTailwindFeatures from './processTailwindFeatures'
export default function (configOrPath = {}) {
return [
env.DEBUG &&
function (root) {
console.log('\n')
console.time('JIT TOTAL')
return root
},
function (root, result) {
let setupContext =
env.TAILWIND_MODE === 'watch'
? setupWatchingContext(configOrPath)
: setupTrackingContext(configOrPath)
processTailwindFeatures(setupContext)(root, result)
},
env.DEBUG &&
function (root) {
console.timeEnd('JIT TOTAL')
console.log('\n')
return root
},
].filter(Boolean)
}