UNPKG

981 BJavaScriptView Raw
1import postcss from "postcss"
2import color from "chalk"
3
4let shouldGlobalWarn = true
5export const resetWarning = () => shouldGlobalWarn = true
6
7const warnForDeprecations = postcss.plugin(
8 "postcss-cssnext-warn-for-deprecations",
9 ({ console: messenger }) => {
10 return (style) => {
11 // warn for removed @apply
12 style.walkAtRules("apply", () => {
13 if (shouldGlobalWarn) {
14 shouldGlobalWarn = false
15 messenger.log(
16color.yellow.bold(
17 "You are using @apply rule and custom property sets. \n" +
18
19 "This feature won't be included in next the major release "+
20 "of postcss-cssnext. \n"
21) +
22
23color.grey(
24 "This most likely won't get any more support from browser vendors as the " +
25 "spec is yet considered deprecated and alternative solutions are being "+
26 "discussed. \n"
27) +
28
29 "Read more about the reason here https://github.com/pascalduez/postcss-apply."
30 )
31 }
32 })
33 }
34 }
35)
36
37export default warnForDeprecations