Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
feat: add ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
mg901 committed Oct 13, 2019
1 parent 4f6a85c commit 12940bb
Showing 1 changed file with 48 additions and 42 deletions.
90 changes: 48 additions & 42 deletions index.js
Expand Up @@ -23,54 +23,60 @@ const defaultConfig = {
ratio: 1.333,
};

exports.ratios = ratios;
const typographist = plugin(
'typographist',
(config = defaultConfig) => (root) => {
const breakpointsMap = makeBreakpointsMap(config);

module.exports = plugin('typographist', (config = defaultConfig) => (root) => {
const breakpointsMap = makeBreakpointsMap(config);
root.walkDecls((decl) => {
if (isStep(decl)) {
step(decl, breakpointsMap);
}

root.walkDecls((decl) => {
if (isStep(decl)) {
step(decl, breakpointsMap);
}
if (isStepFunction(decl, breakpointsMap)) {
stepFunction(decl, breakpointsMap);
}
});

if (isStepFunction(decl, breakpointsMap)) {
stepFunction(decl, breakpointsMap);
}
});
root.walkAtRules((atrule) => {
if (isBubblingAtrule(atrule)) {
bubblingAtrule(atrule);
}
});

root.walkAtRules((atrule) => {
if (isBubblingAtrule(atrule)) {
bubblingAtrule(atrule);
}
});
root.walkAtRules((atrule) => {
const atrules = {
root: renderRoot,
base: renderBase,
up: renderUp,
down: renderDown,
only: renderOnly,
between: renderBetween,
};

root.walkAtRules((atrule) => {
const atrules = {
root: renderRoot,
base: renderBase,
up: renderUp,
down: renderDown,
only: renderOnly,
between: renderBetween,
};
if (atrules[atrule.name]) {
atrules[atrule.name](atrule, breakpointsMap);
}
});

if (atrules[atrule.name]) {
atrules[atrule.name](atrule, breakpointsMap);
}
});
root.walkRules((rule) => {
if (isBubblingRule(rule)) {
bubblingRule(rule);
}

root.walkRules((rule) => {
if (isBubblingRule(rule)) {
bubblingRule(rule);
}
if (isNestedRule(rule)) {
nestedRule(rule);
}
});

if (isNestedRule(rule)) {
nestedRule(rule);
}
});
// Remove empty rules.
root.walkRules((rule) => {
if (!rule.nodes.length) rule.remove();
});
},
);

// Remove empty rules.
root.walkRules((rule) => {
if (!rule.nodes.length) rule.remove();
});
});
module.exports = {
ratios,
typographist,
};

0 comments on commit 12940bb

Please sign in to comment.