Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

beforeBlockString.js 961B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. /** @typedef {import('postcss').Rule} Rule */
  3. /** @typedef {import('postcss').AtRule} AtRule */
  4. /**
  5. * @param {Rule | AtRule} statement
  6. * @param {{
  7. * noRawBefore?: boolean
  8. * }} options
  9. *
  10. * @returns {string}
  11. */
  12. module.exports = function (statement, options = {}) {
  13. let result = '';
  14. /** @type {Rule | undefined} */
  15. let rule; /*?: postcss$rule*/
  16. /** @type {AtRule | undefined} */
  17. let atRule; /*?: postcss$atRule*/
  18. if (statement.type === 'rule') {
  19. rule = statement;
  20. }
  21. if (statement.type === 'atrule') {
  22. atRule = statement;
  23. }
  24. if (!rule && !atRule) {
  25. return result;
  26. }
  27. const before = statement.raws.before || '';
  28. if (!options.noRawBefore) {
  29. result += before;
  30. }
  31. if (rule) {
  32. result += rule.selector;
  33. }
  34. if (atRule) {
  35. result += `@${atRule.name}${atRule.raws.afterName || ''}${atRule.params}`;
  36. }
  37. const between = statement.raws.between;
  38. if (between !== undefined) {
  39. result += between;
  40. }
  41. return result;
  42. };