MCPcopy
hub / github.com/tailwindlabs/prettier-plugin-tailwindcss / TextNode

Function TextNode

src/index.ts:258–281  ·  view source on GitHub ↗
(node, path, meta)

Source from the content-addressed store, hash-verified

256 },
257
258 TextNode(node, path, meta) {
259 if (!meta.sortTextNodes) {
260 return
261 }
262
263 let concat = path.find((entry) => {
264 return entry.parent && entry.parent.type === 'ConcatStatement'
265 })
266
267 let siblings = {
268 prev: concat?.parent.parts[concat.index! - 1],
269 next: concat?.parent.parts[concat.index! + 1],
270 }
271
272 node.chars = sortClasses(node.chars, {
273 env,
274 ignoreFirst: siblings.prev && !/^\s/.test(node.chars),
275 ignoreLast: siblings.next && !/\s$/.test(node.chars),
276 collapseWhitespace: {
277 start: !siblings.prev,
278 end: !siblings.next,
279 },
280 })
281 },
282
283 StringLiteral(node, path, meta) {
284 if (!meta.sortTextNodes) {

Callers

nothing calls this directly

Calls 1

sortClassesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…