CSS Modules
What are CSS Modules?
Using CSS Modules in Melody
{% import './home.css' as styles %}
<div class="{{ styles.home }}">
<div class="{{ styles.logo }}">
<svg xmlns="http://www.w3.org/2000/svg" width="270" height="270" viewBox="0 0 270 270">
<circle cx="135" cy="135" r="135" fill="#272361"></circle>
<path d="M146.14 87.94a45 45 0 0 0-53.24 53.23L48.08 186a9 9 0 1 0 3.38 3l42.79-42.79a45 45 0 0 0 9.34 16l-24.05 24.03a9 9 0 1 0 3.19 3.18l24.05-24.05a45 45 0 0 0 16 9.34l-11.43 11.43a9 9 0 1 0 3.26 3.1l13.18-13.18a45 45 0 0 0 18.35-88.12z" fill="#6eceb2"></path>
<circle cx="152.46" cy="100.5" r="13.5" fill="#fff"></circle>
<circle cx="150.46" cy="102.5" r="4.5" fill="#272361"></circle>
<circle cx="173.96" cy="117" r="9" fill="#fff"></circle>
<circle cx="171.96" cy="117" r="3" fill="#272361"></circle>
<path d="M140.2 34.39a4.45 4.45 0 0 1 0 6.36 4.62 4.62 0 0 1-6.47 0 4.45 4.45 0 0 1 0-6.36 4.62 4.62 0 0 1 6.47 0zM73.94 62.38a4.45 4.45 0 0 1 0 6.36 4.62 4.62 0 0 1-6.47 0 4.45 4.45 0 0 1 0-6.36 4.62 4.62 0 0 1 6.47 0zM206.45 62.38a4.45 4.45 0 0 1 0 6.36 4.62 4.62 0 0 1-6.47 0 4.45 4.45 0 0 1 0-6.36 4.62 4.62 0 0 1 6.47 0zM234.45 128.64a4.45 4.45 0 0 1 0 6.36 4.62 4.62 0 0 1-6.47 0 4.45 4.45 0 0 1 0-6.36 4.62 4.62 0 0 1 6.47 0zM200 201.62a4.45 4.45 0 0 1 0-6.36 4.62 4.62 0 0 1 6.47 0 4.45 4.45 0 0 1 0 6.36 4.62 4.62 0 0 1-6.47 0z" fill="#6eceb2"></path>
</svg>
</div>
<h1 class="{{ styles.title }}">
{{ message }}
</h1>
</div>.home {
text-align: center;
color: #fff;
}
.logo {
margin: 20px 0;
}
.title {
padding: 0;
margin: 20px 0;
}Importing only some classes
Use with the classes filter
Using multiple classes
Last updated
Was this helpful?