Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed May 4, 2022
1 parent 50877a2 commit d6916ed
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ function oneOf(...options) {
)
}

function loadPostcss() {
// Try to load a local `postcss` version first
try {
if (!process.env.BUILT_IN_POSTCSS) {
return require('postcss')
}
} catch {}

return lazyPostcss()
}

let commands = {
init: {
run: init,
Expand Down Expand Up @@ -576,18 +587,8 @@ async function build() {
})(),
].filter(Boolean)

function loadPostcss() {
// Try to load a local `postcss` version first
try {
if (!process.env.BUILT_IN_POSTCSS) {
return require('postcss')
}
} catch {}

return lazyPostcss()
}

let processor = loadPostcss()(plugins)
let postcss = loadPostcss()
let processor = postcss(plugins)

function processCSS(css) {
let start = process.hrtime.bigint()
Expand Down Expand Up @@ -720,6 +721,7 @@ async function build() {
let tailwindPluginIdx = plugins.indexOf('__TAILWIND_PLUGIN_POSITION__')
let copy = plugins.slice()
copy.splice(tailwindPluginIdx, 1, tailwindPlugin)
let postcss = loadPostcss()
let processor = postcss(copy)

function processCSS(css) {
Expand Down

0 comments on commit d6916ed

Please sign in to comment.