Skip to content

Commit bf9e3c6

Browse files
committed
Add mode option to use JIT code path
1 parent a2b9c42 commit bf9e3c6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import resolveConfig from './util/resolveConfig'
1111
import getAllConfigs from './util/getAllConfigs'
1212
import { supportedConfigFiles } from './constants'
1313
import defaultConfig from '../stubs/defaultConfig.stub.js'
14+
import log from './util/log'
1415

1516
function resolveConfigPath(filePath) {
1617
// require('tailwindcss')({ theme: ..., variants: ... })
@@ -65,20 +66,27 @@ const getConfigFunction = (config) => () => {
6566
}
6667

6768
module.exports = function (config) {
68-
const plugins = []
6969
const resolvedConfigPath = resolveConfigPath(config)
70+
const getConfig = getConfigFunction(resolvedConfigPath || config)
71+
const mode = _.get(getConfig(), 'mode', 'aot')
72+
73+
if (mode === 'jit') {
74+
log.warn([
75+
`You have enabled the JIT engine which is currently in preview.`,
76+
'Preview features are not covered by semver, may introduce breaking changes, and can change at any time.',
77+
])
78+
return require('../jit/index.js')(config)
79+
}
80+
81+
const plugins = []
7082

7183
if (!_.isUndefined(resolvedConfigPath)) {
7284
plugins.push(registerConfigAsDependency(resolvedConfigPath))
7385
}
7486

7587
return {
7688
postcssPlugin: 'tailwindcss',
77-
plugins: [
78-
...plugins,
79-
processTailwindFeatures(getConfigFunction(resolvedConfigPath || config)),
80-
formatCSS,
81-
],
89+
plugins: [...plugins, processTailwindFeatures(getConfig), formatCSS],
8290
}
8391
}
8492

0 commit comments

Comments
 (0)