add initial marp implementation with sample content and build configuration
This commit is contained in:
27
node_modules/@marp-team/marpit/lib/postcss/root/rem.js
generated
vendored
Normal file
27
node_modules/@marp-team/marpit/lib/postcss/root/rem.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.rem = exports.default = void 0;
|
||||
var _postcss_plugin = _interopRequireDefault(require("../../helpers/postcss_plugin"));
|
||||
var _font_size = require("./font_size");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/** @module */
|
||||
|
||||
const skipParsingMatcher = /("[^"]*"|'[^']*'|(?:attr|url|var)\([^)]*\))/g;
|
||||
|
||||
/**
|
||||
* Marpit PostCSS rem plugin.
|
||||
*
|
||||
* Replace `rem` unit to calculated value from CSS variable.
|
||||
*
|
||||
* @function rem
|
||||
*/
|
||||
const rem = exports.rem = (0, _postcss_plugin.default)('marpit-postcss-rem', () => css => css.walkDecls(decl => {
|
||||
decl.value = decl.value.split(skipParsingMatcher).map((v, i) => {
|
||||
if (i % 2) return v;
|
||||
return v.replace(/(\d*\.?\d+)rem\b/g, (_, num) => `calc(var(${_font_size.rootFontSizeCustomProp}, 1rem) * ${num})`);
|
||||
}).join('');
|
||||
}));
|
||||
var _default = exports.default = rem;
|
||||
Reference in New Issue
Block a user