Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable tailwindcss to run in restricted permissions environment (eg. Deno Webworker w/o read permissions) #14300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions src/lib/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export function parseCandidateFiles(context, tailwindConfig) {
files = files.map(normalizePath)

// Split into included and excluded globs
let tasks = fastGlob.generateTasks(files)
let tasks = [];
if (files.length) {
tasks.push(...fastGlob.generateTasks(files))
}

/** @type {ContentPath[]} */
let included = []
Expand All @@ -56,14 +59,16 @@ export function parseCandidateFiles(context, tailwindConfig) {

let paths = [...included, ...excluded]

// Resolve paths relative to the config file or cwd
paths = resolveRelativePaths(context, paths)
if (paths.length) {
// Resolve paths relative to the config file or cwd
paths = resolveRelativePaths(context, paths)

// Resolve symlinks if possible
paths = paths.flatMap(resolvePathSymlinks)
// Resolve symlinks if possible
paths = paths.flatMap(resolvePathSymlinks)

// Update cached patterns
paths = paths.map(resolveGlobPattern)
// Update cached patterns
paths = paths.map(resolveGlobPattern)
}

return paths
}
Expand Down Expand Up @@ -264,7 +269,10 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {

let changedFiles = new Set()
env.DEBUG && console.time('Finding changed files')
let files = fastGlob.sync(paths, { absolute: true })
let files = [];
if (paths.length) {
files.push(...fastGlob.sync(paths, { absolute: true }))
}
for (let file of files) {
checkBroadPattern(file)

Expand Down