tancredi/fantasticon

edit contents of scss output

eendkonijn opened this issue · 1 comments

Hello, thanks for this package, very useful! I have a question/suggestion. At the moment, when I generate an scss file, it outputs a file with a font-face declaration. I would like the output to be just the variable map. Is this possible?

current output:

$trinity-iconfont-font: "trinity-iconfont";

@font-face {
    font-family: $trinity-iconfont-font;
    src: url("./trinity-iconfont.woff?55321795d3354290fd22d5fc0f063eae")
            format("woff"),
        url("./trinity-iconfont.woff2?55321795d3354290fd22d5fc0f063eae")
            format("woff2");
}

i[class^="icon-"]:before,
i[class*=" icon-"]:before {
    font-family: trinity-iconfont !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

$trinity-iconfont-map: (
    "externalLinkIcon": "\f117",
    "checkIcon": "\f103",
    "lineCrossIcon": "\f10a",
    "alertIcon": "\f101",
    "arrowForwardIcon": "\f102",
    "arrowReplyIcon": "\f104",
    "bellIcon": "\f105",
    "boxIcon": "\f106",
    {...etc}

my fantasticonrc:

module.exports = {
    inputDir: "style-dictionary/assets/fonts/iconfont/svg", // (required)
    outputDir: "style-dictionary/assets/fonts/iconfont/", // (required)
    fontTypes: ["woff", "woff2"],
    assetTypes: ["scss", "css", "json"],
    codepoints: {
        externalLinkIcon: 61719,
        checkIcon: 61699,
        lineCrossIcon: 61706,
    },
    pathOptions: {
        scss: "packages/styles/src/variables/_iconfont-tokens.scss",
        woff: "packages/styles/src/variables/trinity-iconfont.woff",
    },
};

I would also like to know the answer to this. The reason being I would like to use a base64 version font-face of the generated font file instead.