plugin.less 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // importing plugin globally
  2. @plugin "plugin/plugin-global";
  3. // transitively include plugins from importing another sheet
  4. @import "./plugin/plugin-transitive";
  5. // `test-global` function should be reachable
  6. // `test-local` function should not be reachable
  7. // `test-shadow` function should return global version
  8. .class {
  9. trans : test-transitive();
  10. global : test-global();
  11. local : test-local();
  12. shadow : test-shadow();
  13. // `test-global` function should propagate and be reachable
  14. // `test-local` function should be reachable
  15. // `test-shadow` function should return local version, shadowing global version
  16. .local {
  17. @plugin (option) "./plugin/plugin-local";
  18. global : test-global();
  19. local : test-local();
  20. shadow : test-shadow();
  21. }
  22. }
  23. // calling a mixin or detached ruleset should not bubble local plugins
  24. // imported inside either into the parent scope.
  25. .mixin() {
  26. @plugin "./plugin/plugin-local";
  27. mixin-local : test-local();
  28. mixin-global : test-global();
  29. mixin-shadow : test-shadow();
  30. }
  31. @ruleset : {
  32. @plugin "./plugin/plugin-local";
  33. ruleset-local : test-local();
  34. ruleset-global : test-global();
  35. ruleset-shadow : test-shadow();
  36. };
  37. #ns {
  38. @plugin (test=test) "./plugin/plugin-local";
  39. .mixin() {
  40. ns-mixin-global : test-global();
  41. ns-mixin-local : test-local();
  42. ns-mixin-shadow : test-shadow();
  43. }
  44. }
  45. .class {
  46. #ns > .mixin();
  47. .mixin();
  48. @ruleset();
  49. class-local : test-local();
  50. }
  51. // `test-global` function should propagate into directive scope
  52. @media screen {
  53. .test {
  54. result : test-global();
  55. }
  56. }
  57. @font-face {
  58. result : test-global();
  59. }
  60. // `test-global` function should propagate into nested directive scopes
  61. @media screen and (min-width:100px) {
  62. @media (max-width:400px) {
  63. .test {
  64. result : test-global();
  65. }
  66. }
  67. }
  68. .test {
  69. @media screen {
  70. @plugin "./plugin/plugin-local";
  71. result : test-local();
  72. }
  73. }
  74. @plugin "./plugin/plugin-tree-nodes";
  75. @ruleset2: test-detached-ruleset();
  76. .root {
  77. @ruleset2();
  78. }
  79. .test-empty {
  80. val1: foo;
  81. test-collapse();
  82. val2: foo;
  83. }
  84. .test-simple {
  85. @plugin "./plugin/plugin-simple";
  86. value: pi-anon();
  87. value: (pi() * 2);
  88. }
  89. .test-conflicts {
  90. @plugin "./plugin/plugin-scope1";
  91. value: foo();
  92. }
  93. .test-conflicts {
  94. @plugin "./plugin/plugin-scope2";
  95. value: foo();
  96. }
  97. .test-conflicts {
  98. @plugin "./plugin/plugin-scope1";
  99. value: foo();
  100. }
  101. .test-collection {
  102. @plugin "./plugin/plugin-collection";
  103. @var: 32;
  104. store(@var);
  105. store(5);
  106. store("bird");
  107. list: list();
  108. }
  109. test-atrule("@charset"; '"utf-8"');
  110. test-atrule("@arbitrary"; "value after ()");
  111. // no minVersion specified
  112. @plugin (option1) "./plugin/plugin-set-options";
  113. @plugin "./plugin/plugin-set-options";
  114. @plugin (option2) "./plugin/plugin-set-options";
  115. @plugin "./plugin/plugin-set-options";
  116. @plugin (option3) "./plugin/plugin-set-options";
  117. // specifies minVersion: [2,0,0]
  118. @plugin (option1) "./plugin/plugin-set-options-v2";
  119. @plugin "./plugin/plugin-set-options-v2";
  120. @plugin (option2) "./plugin/plugin-set-options-v2";
  121. @plugin "./plugin/plugin-set-options-v2";
  122. @plugin (option3) "./plugin/plugin-set-options-v2";
  123. // specifies minVersion: [3,0,0]
  124. @plugin (option1) "./plugin/plugin-set-options-v3";
  125. @plugin "./plugin/plugin-set-options-v3";
  126. @plugin (option2) "./plugin/plugin-set-options-v3";
  127. @plugin "./plugin/plugin-set-options-v3";
  128. @plugin (option3) "./plugin/plugin-set-options-v3";