How to Use st-core.fscss with Svelte (Compiled)
st-core.fscss draws charts with pure CSS, clip-path polygons plus custom properties, no JS chart library, no SVG, no canvas. Svelte doesn't need to draw anything for it. It just needs to own the data and reactively set --st-p1 , --st-p2 , and so on whenever your series changes. Wanted to write up the actual integration because getting the responsibilities split correctly took me a minute the…
Using st-core.fscss with Svelte involves three layers. First, write the entry file src/styles/st-core.fscss to import the necessary modules and define a chart data array. The length of this array determines the number of chart points. Second, compile the file as part of the build process using FSCSS. This process expands the chart mixins into static CSS.
Finally, import the compiled CSS into your Svelte app and map your data to CSS variables that control the chart's appearance. The Svelte component should take in the data as props and calculate the CSS variables for each point, inverting the values to ensure high values appear lower on the chart.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.