Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Prevent nesting plugin from breaking other plugins ([#7563](https://github.com/tailwindlabs/tailwindcss/pull/7563))
- Recursively collapse adjacent rules ([#7565](https://github.com/tailwindlabs/tailwindcss/pull/7565))
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
- Preserve source maps for generated CSS ([#7588](https://github.com/tailwindlabs/tailwindcss/pull/7588))

## [3.0.23] - 2022-02-16

Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"jest-diff": "^27.5.1",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.7",
"rimraf": "^3.0.0"
"rimraf": "^3.0.0",
"source-map-js": "^1.0.2"
},
"peerDependencies": {
"autoprefixer": "^10.0.2",
Expand Down
10 changes: 8 additions & 2 deletions src/lib/expandApplyAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function processApply(root, context) {
for (let apply of applies) {
let candidates = perParentApplies.get(apply.parent) || []

perParentApplies.set(apply.parent, candidates)
perParentApplies.set(apply.parent, [candidates, apply.source])

let [applyCandidates, important] = extractApplyCandidates(apply.params)

Expand Down Expand Up @@ -178,7 +178,7 @@ function processApply(root, context) {
}
}

for (const [parent, candidates] of perParentApplies) {
for (const [parent, [candidates, atApplySource]] of perParentApplies) {
let siblings = []

for (let [applyCandidate, important, rules] of candidates) {
Expand Down Expand Up @@ -220,6 +220,12 @@ function processApply(root, context) {
}

let root = postcss.root({ nodes: [node.clone()] })

// Make sure every node in the entire tree points back at the @apply rule that generated it
root.walk((node) => {
node.source = atApplySource
})

let canRewriteSelector =
node.type !== 'atrule' || (node.type === 'atrule' && node.name !== 'keyframes')

Expand Down
8 changes: 6 additions & 2 deletions src/lib/resolveDefaultsAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,19 @@ export default function resolveDefaultsAtRules({ tailwindConfig }) {
}

for (let [, selectors] of selectorGroups) {
let universalRule = postcss.rule()
let universalRule = postcss.rule({
source: universal.source,
})

universalRule.selectors = [...selectors]

universalRule.append(universal.nodes.map((node) => node.clone()))
universal.before(universalRule)
}
} else {
let universalRule = postcss.rule()
let universalRule = postcss.rule({
source: universal.source,
})

universalRule.selectors = ['*', '::before', '::after']

Expand Down
6 changes: 6 additions & 0 deletions src/util/cloneNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ export default function cloneNodes(nodes, source) {

if (source !== undefined) {
cloned.source = source

if ('walk' in cloned) {
cloned.walk((child) => {
child.source = source
})
}
}

return cloned
Expand Down
Loading