mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Update lockfile * Tweak formatting * Refactor content path parsing * Allow resolving content paths relative to the config file * Include resolved symlinks as additional content paths * Update changelog * Work on suite of tests for content resolution * reformat integration test list * Move content resolution tests to integration * Update future and experimental types
25 lines
507 B
JavaScript
25 lines
507 B
JavaScript
import globParent from 'glob-parent'
|
|
|
|
// Based on `glob-base`
|
|
// https://github.com/micromatch/glob-base/blob/master/index.js
|
|
export function parseGlob(pattern) {
|
|
let glob = pattern
|
|
let base = globParent(pattern)
|
|
|
|
if (base !== '.') {
|
|
glob = pattern.substr(base.length)
|
|
if (glob.charAt(0) === '/') {
|
|
glob = glob.substr(1)
|
|
}
|
|
}
|
|
|
|
if (glob.substr(0, 2) === './') {
|
|
glob = glob.substr(2)
|
|
}
|
|
if (glob.charAt(0) === '/') {
|
|
glob = glob.substr(1)
|
|
}
|
|
|
|
return { base, glob }
|
|
}
|