1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-16 18:14:09 +02:00

feat: single SVG for arrow, change color on import

This commit is contained in:
Jonas Kuske
2019-06-07 00:48:35 +02:00
parent 436a4211eb
commit f7c6a87ca9
5 changed files with 10 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ function style() {
.src(paths.styles.src)
// Add sourcemaps
.pipe(sourcemaps.init())
// Resolve imports and calculated colors
// Resolve imports, calculated colors and inlined SVG files
.pipe(postcss([postcssImport(), postcssColorModFunction(), postcssInlineSvg()]))
// * Process legacy builds *
@@ -95,8 +95,8 @@ function style() {
.pipe(filter('**/*.css'))
// Calculate size before minifying
.pipe(bytediff.start())
// Minify using cssnano
.pipe(postcss([cssnano()]))
// Minify using cssnano, use extra-low precision while minifying inline SVGs
.pipe(postcss([cssnano({ preset: ['default', { svgo: { floatPrecision: 0 } }] })]))
// Write the amount saved by minifying
.pipe(bytediff.stop(data => formatByteMessage('cssnano', data)))
// Rename the files have the .min suffix

4
src/assets/select-arrow.svg Executable file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="62.5" width="116.9">
<path d="M115.3,1.6 C113.7,0 111.1,0 109.5,1.6 L58.5,52.7 L7.4,1.6 C5.8,0 3.2,0 1.6,1.6 C0,3.2 0,5.8 1.6,7.4 L55.5,61.3 C56.3,62.1 57.3,62.5 58.4,62.5 C59.4,62.5 60.5,62.1 61.3,61.3 L115.2,7.4 C116.9,5.8 116.9,3.2 115.3,1.6Z"/>
</svg>

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -44,7 +44,7 @@ textarea {
}
select {
background: var(--background) var(--down-arrow-path) calc(100% - 12px) 50% / 12px no-repeat;
background: var(--background) var(--select-arrow) calc(100% - 12px) 50% / 12px no-repeat;
padding-right: 35px;
}

View File

@@ -22,5 +22,5 @@
--form-placeholder: #a9a9a9;
--form-text: #ffffff;
--down-arrow-path: svg-load("../arrow-light.svg");
--select-arrow: svg-load('./assets/select-arrow.svg', fill: #efefef);
}

View File

@@ -22,5 +22,5 @@
--form-placeholder: #949494;
--form-text: #000000;
--down-arrow-path: svg-load("../arrow-dark.svg");
--select-arrow: svg-load('./assets/select-arrow.svg', fill: #161f27);
}