avatarPavle Marinkovic

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2713

Abstract

Files</h1><p id="aea6">We need to add a <code>tailwind.config.js</code> and a <code>postcss.config.js</code> file to the root of our application. Use the following command to set this up:</p><div id="ee16"><pre>npx tailwindcss <span class="hljs-keyword">init</span> -p</pre></div><p id="414e">This will create a <code>tailwind.config.js</code> file at the root of your project:</p> <figure id="59e0"> <div> <div>

            <iframe class="gist-iframe" src="/gist/BetterProgramming/5f1fc501fe510339576a69bd5936c2b1.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="21b1">Learn more about configuring Tailwind in the <a href="https://tailwindcss.com/docs/configuration">configuration documentation</a>.</p><p id="374c">It will also create a <code>postcss.config.js</code> file that includes <code>tailwindcss</code> and <code>autoprefixer</code> configured:</p>
    <figure id="5464">
        <div>
          <div>
            
            <iframe class="gist-iframe" src="/gist/BetterProgramming/373cad919a6f591df7649efec7dcce78.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><h1 id="d634">Import the CSS</h1><p id="07d3">Let’s create a <code>styles</code> folder and import Tailwind CSS from a CSS file:</p><div id="236d"><pre><span class="hljs-built_in">touch</span> styles/tailwind.css</pre></div><p id="79bb">Inside <code>tailwind.css</code>:</p><div id="33c2"><pre><span class="hljs-variable">@tailwind</span> base;

<span class="hljs-variable">@tailwind</span> components; <span class="hljs-variable">@tailwind</span> utilities;</pre></div><p id="5160">To add global CSS to a Next.js app, we need to override the default <code>App</code> component. With Next.js 10, you should already have <code>_app.js</code> inside your pages folder. Now import the stylesheet we created:</p><div id="da6f"><pre><span class="hljs-function"><span class="hljs-title">import</span></span> <span class="hljs-string">'../styles/globals.css'</span> <span class="hljs-function"><span class="hljs-title">import</span></span> <span class="hljs-string">'../styles/tailwind.css'</span>;</pre></div><div id="c873"><pre><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">MyApp</span>(<span class="hljs-params">{ Component, pageProps }</span>) { <span class="hljs-keyword">return</span> <span class="language-xm

Options

l"><span class="hljs-tag"><<span class="hljs-name">Component</span> {<span class="hljs-attr">...pageProps</span>} /></span></span>; }</pre></div><p id="cd5c">Cool, now we are ready to add some Tailwind CSS magic to our home page. Go to <code>/pages/index.js</code> (or <code>/pages/index.tsx</code> if you use TypeScript) and add some elements with Tailwind CSS classes. For example:</p> <figure id="7022"> <div> <div>

            <iframe class="gist-iframe" src="/gist/BetterProgramming/5d768ccc213a3d4eeff44d3955cebd3d.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="12b1">Run <code>yarn dev</code> to see your app on <a href="https://localhost:4202/settings/departments">http://localhost:3000</a> in your browser.</p><h1 id="996b">Configure PurgeCSS</h1><p id="d1b6">One problem with Tailwind CSS is the large file size, but <a href="https://github.com/FullHuman/purgecss">PurgeCSS</a> can fix this. PurgeCSS reduces the file size by scanning your HTML and removing any classes that aren’t used. We only want this in production because if we are developing, we want to be able to use any Tailwind CSS class without running the build process.</p><p id="a37c">Now with Tailwind CSS v2, PurgeCSS is already included. All you have to do is update the <code>tailwind.config.js</code> file so Tailwind can tree-shake unused styles in production builds. Update your file like this:</p>
    <figure id="c01b">
        <div>
          <div>
            
            <iframe class="gist-iframe" src="/gist/BetterProgramming/4fe51a3e9e7f33b4e647ffee294f8cdb.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="2dad">For now, we check all of our code inside <code>.js, .jsx, .ts or .tsx</code> files that live in either the <code>pages/</code> or <code>components/</code> folder. If you plan to add HTML in other folders like <code>containers/</code> or something, make sure you add that folder to this configuration file.</p><p id="29a2">You can read the guide from Tailwind on <a href="https://tailwindcss.com/docs/optimizing-for-production">optimizing for production</a> to learn more about tree-shaking unused styles for best performance.</p><h1 id="6371">Conclusion</h1><p id="fafc">Now we are ready to work with the latest versions of Next.js and Tailwind CSS without having to worry about bundle sizes!</p><p id="fdfe">That’s it! Thanks for reading. I hope it was helpful.</p></article></body>

How Your Music Taste Reveals Your Moral Values

The ethics behind our playlists

AI-generated image with Dall-E

Are the songs you play on repeat a window into your ethics?

Your music preferences could reveal more about yourself than you think.

By looking at the songs you like, somebody can tell the rhythm of your moral heartbeat:

  • Blasting heavy metal? You shred societal norms.
  • Country tracks on loop? You’re all about tradition and community.
  • All about indie? You’re a free thinker and nonconformist.

Sounds outrageous, right?

Well, hold that thought.

However, there might be some truth in all of this. And as you’ll see, that’s just the tip of the iceberg.

The melody of morals

Researchers from the Queen Mary University and ISI Foundation were intrigued by what our musical preferences say about us. They asked themselves if what we listen to, especially songs with lyrics, could tell something about our moral values.

Using the Facebook app LikeYouth.org, researchers analyzed the favorite tunes of 1,386 users. The academics mainly targeted users in Italy and analyzed their likes on music artist pages.

They grabbed the lyrics of the user’s top 5 songs, shown by their Facebook likes, and used text analysis techniques to extract features from these lyrics like the song’s broad narrative, moral valence, and emotion.

I know. Facebook likes aren’t entirely accurate in measuring who’s your favorite artists. But it can work as a proxy at least.

Then, they matched these lyrical features with users’ moral values, which were gathered through questionnaires. The goal was to see if one could predict a person’s moral values based on the emotions and content of their favorite songs’ lyrics.

Decoding values in the verses we love

Academics confirmed that lyrics say something about people’s morality.

However, some values have a stronger correlation with music lyrics than others:

  • Old-school values like hierarchy and tradition have a moderate link (0.2 to 0.3) with lyrics that talk about these values.
  • More progressive values like empathy and equality have a weaker link (0.08 to 0.11) with music preferences talking about these values.

Why the difference?

This might be because the music industry often highlights traditional values more explicitly in lyrics.

Other factors like age and gender have some influence as well. For instance, someone under 25 and an older person might both enjoy songs with themes of authority and tradition, despite their age difference and share similar moral values. However, they don’t drive the connection between music preferences and moral values.

Our ethics play a more significant role in determining the lyrics and types of music we prefer.

The big lesson here is that lyrics are more than just words. They are a mirror of our values.

How can we use this in the real world?

This goes beyond just a conversation starter at a party.

Here are two ways this music-moral link can serve in everyday life.

Think about personality tests at work. HR could look at your Spotify playlist instead of those endless questionnaires. Why? To assess your fit in their culture or your alignment with their values.

For instance, if the organization values innovation and disruption, they might look for people whose music preferences suggest an inclination towards creativity and non-conformity.

Am I saying this will replace tests? No. It’s just an additional metric to consider in HR practices.

It’s also a window into our collective soul. We could tap into societal trends based on top charts, like a diagnostic tool of what we are currently valuing more collectively.

If a certain type of music with specific moral guidelines is consistently at the top charts, it could reflect broader societal values or shifts in people’s moral perspective. For example, a surge in songs with themes of rebellion and anti-establishment sentiment might mirror a growing societal trend of questioning authority.

Could we even predict a new social movement rising by looking at what people listen to most frequently? Who knows, but there’s potential.

The conductor of the social orchestra

Let’s take a hard left turn and talk about religious music as a proxy for moral behavior.

Religion is like a maestro running the show in an orchestra, but instead of music, it’s been calling the shots on how we should all act. And what better way to influence people than through music? From Gregorian chants to gospel choirs, religious music has been subtly guiding the moral narrative throughout history.

Our moral psyche has been molded by religion in one way or another. The lyrics (a.k.a. sermons and religious songs) coupled with deep chords can be powerful triggers to behave ethically.

This is evident in a fascinating study by academics from the University of Connecticut and Duke University. Academics wanted to see if religious tunes, whether they were vocal or instrumental, could bend our moral compass.

They rounded up people in Mauritius, the Czech Republic, and the USA and split them into groups.

  • One group got religious tunes.
  • One got secular jams.
  • One listened to white noise.

After this musical appetizer, they put the participants to the test. They had to solve math problems and report how many they got right. But there was a subtle twist that tempted participants to lie.

More right answers meant more cash.

Would you play by the rules or bend them for some extra cash?

The researchers got some interesting results.

Turns out, where you’re from and how religious you are might twist how you react to these tunes.

  • In Mauritius, where religion is a central part of daily life, people listening to religious music lie less. They claimed fewer solved math problems, suggesting less cheating.
  • In the Czech Republic and the USA, listening to religious music didn’t affect their behavior.

The more religious you are, the more the holy beats steer you toward honesty.

But the real lesson might be more terrifying.

Religious music might act as a kind of conditioned stimulus.

Just like Pavlov’s dogs who learned to associate the sound of a bell with food, people might subconsciously associate religious music with moral behavior.

It’s a deep conditioned response that’s automatic.

In societies with frequent religious rituals involving music, individuals might be “classically conditioned” to link these sounds with certain ethical behaviors. Imagine being stimulated endlessly by lyrics that tell you how to behave. Next time you listen to similar religious songs, you’ll easily go into a default mode and act the way you’re supposed to.

Hearing religious music could trigger a specific behavioral pattern aligned with particular moral teachings.

And you might be completely unaware of this!

Takeaway

The first study tells us that what people listen to reflects what they value. Old-school values like tradition have a stronger beat in our favorite tracks than progressive values like equality.

Our principles could lie between the melodies we listen to.

The second study suggests how deeply embedded religious practices could be in shaping our responses to seemingly innocent stimuli like music. We saw that in Mauritius, religious songs led to more honesty; not so much in the Czech Republic and the USA. In less religiously driven societies, religious music has a limited influence on moral decision-making.

So, what’s the big takeaway here?

Our music choices are not just background noise. They reflect and maybe even shape our moral compass. These melodies might be tuning our ethical behaviors more than we realize.

Our playlists might not just be playing songs, but they might be playing us.

Want to learn more about the sound verse?

Join my newsletter to explore everything related to music and sound, from the effects on our psyche to the technologies that use sound to improve our lives.

Music
Morality
Ethics
Psychology
Science
Recommended from ReadMedium