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

Commit

Permalink
fix: add export default for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mg901 committed Oct 13, 2019
1 parent 4430627 commit 6f01227
Showing 1 changed file with 42 additions and 48 deletions.
90 changes: 42 additions & 48 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,54 @@ const defaultConfig = {
ratio: 1.333,
};

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

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

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

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

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

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

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

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

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

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

0 comments on commit 6f01227

Please sign in to comment.