Skip to content

Commit

Permalink
feat(meta-css): add supported for quoted fns
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 28, 2023
1 parent f7f1b1a commit 5d8e2fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 6 additions & 2 deletions packages/meta-css/src/convert.ts
Expand Up @@ -8,6 +8,7 @@ import { readJSON, readText } from "@thi.ng/file-io";
import {
COMPACT,
PRETTY,
QUOTED_FNS,
at_media,
css,
type Format,
Expand Down Expand Up @@ -197,7 +198,9 @@ const processInputs = (
: [];
if (!noHeader) bundle.push(generateHeader(specs));
if (!noDecls && specs.decls.length) {
bundle.push(css(specs.decls, { format: procOpts.format }));
bundle.push(
css(specs.decls, { format: procOpts.format, fns: QUOTED_FNS })
);
}
inputs.forEach((input) => processSpec(input, procOpts));
processPlainRules(bundle, procOpts);
Expand All @@ -215,6 +218,7 @@ const processMediaQueries = (
result.push(
css(at_media(mergeMediaQueries(specs.media, queryID), rules), {
format,
fns: QUOTED_FNS,
})
);
}
Expand All @@ -226,7 +230,7 @@ const processPlainRules = (
) => {
const rules = buildDecls(plainRules, specs);
logger.debug("plain rules", rules);
bundle.push(css(rules, { format }));
bundle.push(css(rules, { format, fns: QUOTED_FNS }));
};

const processForceIncludes = (
Expand Down
9 changes: 6 additions & 3 deletions packages/meta-css/src/export.ts
Expand Up @@ -2,7 +2,7 @@
import type { IObjectOf } from "@thi.ng/api";
import { strings, type Command } from "@thi.ng/args";
import { readJSON, readText } from "@thi.ng/file-io";
import { COMPACT, PRETTY, at_media, css } from "@thi.ng/hiccup-css";
import { COMPACT, PRETTY, QUOTED_FNS, at_media, css } from "@thi.ng/hiccup-css";
import type { ILogger } from "@thi.ng/logger";
import { resolve } from "path";
import {
Expand Down Expand Up @@ -52,7 +52,10 @@ export const EXPORT: Command<ExportOpts, CommonOpts, AppCtx<ExportOpts>> = {
if (!noHeader) bundle.push(generateHeader(specs));
if (!noDecls && specs.decls.length) {
bundle.push(
css(specs.decls, { format: pretty ? PRETTY : COMPACT })
css(specs.decls, {
format: pretty ? PRETTY : COMPACT,
fns: QUOTED_FNS,
})
);
}
bundle.push(serializeSpecs(specs, media, pretty, logger));
Expand Down Expand Up @@ -80,7 +83,7 @@ export const serializeSpecs = (
}
}
}
return css(rules, { format: pretty ? PRETTY : COMPACT });
return css(rules, { format: pretty ? PRETTY : COMPACT, fns: QUOTED_FNS });
};

/** @internal */
Expand Down

0 comments on commit 5d8e2fc

Please sign in to comment.