1 | import postcss from "postcss"
|
2 | import color from "chalk"
|
3 |
|
4 | let shouldGlobalWarn = true
|
5 | export const resetWarning = () => shouldGlobalWarn = true
|
6 |
|
7 | const warnForDeprecations = postcss.plugin(
|
8 | "postcss-cssnext-warn-for-deprecations",
|
9 | ({ console: messenger }) => {
|
10 | return (style) => {
|
11 |
|
12 | style.walkAtRules("apply", () => {
|
13 | if (shouldGlobalWarn) {
|
14 | shouldGlobalWarn = false
|
15 | messenger.log(
|
16 | color.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 |
|
23 | color.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 |
|
37 | export default warnForDeprecations
|