Skip to content

Commit

Permalink
chore: format files
Browse files Browse the repository at this point in the history
  • Loading branch information
ludofischer committed Apr 8, 2024
1 parent 904b794 commit d8ada6e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 8 additions & 2 deletions packages/postcss-minify-font-values/src/index.js
Expand Up @@ -28,9 +28,15 @@ function transform(prop, value, opts) {
variableType = opts.removeQuotes(prop);
opts.removeQuotes = true;
}
if ((lowerCasedProp === 'font-weight' || variableType === 'font-weight') && !hasVariableFunction(value)) {
if (
(lowerCasedProp === 'font-weight' || variableType === 'font-weight') &&
!hasVariableFunction(value)
) {
return minifyWeight(value);
} else if ((lowerCasedProp === 'font-family' || variableType === 'font-family') && !hasVariableFunction(value)) {
} else if (
(lowerCasedProp === 'font-family' || variableType === 'font-family') &&
!hasVariableFunction(value)
) {
const tree = valueParser(value);

tree.nodes = minifyFamily(tree.nodes, opts);
Expand Down
18 changes: 7 additions & 11 deletions packages/postcss-minify-font-values/test/index.js
Expand Up @@ -27,7 +27,7 @@ test(
'h1{--font-family:"Helvetica Neue"}',
'h1{--font-family:Helvetica Neue}',
{
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : '')
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : ''),
}
)
);
Expand All @@ -51,7 +51,7 @@ test(
'h1{--font-family:"A";--font-family:"A"}',
'h1{--font-family:A;--font-family:A}',
{
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : '')
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : ''),
}
)
);
Expand All @@ -70,7 +70,7 @@ test(
'h1{--font-family:" Helvetica Neue"}',
'h1{--font-family:\\ Helvetica Neue}',
{
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : '')
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : ''),
}
)
);
Expand All @@ -89,7 +89,7 @@ test(
'h1{--font-family:"Helvetica Neue "}',
'h1{--font-family:Helvetica Neue\\ }',
{
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : '')
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : ''),
}
)
);
Expand All @@ -101,13 +101,9 @@ test(

test(
'css variable should unquote and join identifiers with a slash, if numeric',
processCSS(
'h1{--font-family:"Bond 007"}',
'h1{--font-family:Bond\\ 007}',
{
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : '')
}
)
processCSS('h1{--font-family:"Bond 007"}', 'h1{--font-family:Bond\\ 007}', {
removeQuotes: (prop) => (prop === '--font-family' ? 'font-family' : ''),
})
);

test(
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-minify-font-values/types/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions site/.eleventy.js
@@ -1,7 +1,10 @@
const postcss = require('postcss');
const cssnano = require('cssnano');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const { EleventyRenderPlugin, EleventyHtmlBasePlugin } = require('@11ty/eleventy');
const {
EleventyRenderPlugin,
EleventyHtmlBasePlugin,
} = require('@11ty/eleventy');
const markdownItAnchor = require('markdown-it-anchor');
const markdownIt = require('markdown-it');
const cssnanoVersion = require('../packages/cssnano/package.json').version;
Expand All @@ -11,7 +14,7 @@ module.exports = (config) => {
// tabindex makes scrollable code samples accesible
config.addPlugin(syntaxHighlight, { preAttributes: { tabindex: 0 } });
config.addPlugin(EleventyRenderPlugin);
config.addPlugin(EleventyHtmlBasePlugin)
config.addPlugin(EleventyHtmlBasePlugin);
config.addGlobalData('site_url', 'https://cssnano.github.io/cssnano');
config.addGlobalData('cssnano_version', cssnanoVersion);
// Automatically minify CSS on build
Expand Down Expand Up @@ -40,6 +43,6 @@ module.exports = (config) => {
);
return {
markdownTemplateEngine: 'njk',
pathPrefix: '/cssnano/'
pathPrefix: '/cssnano/',
};
};

0 comments on commit d8ada6e

Please sign in to comment.