question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let's hack `<style>`

See original GitHub issue

In:

<template>
  <h1>hello</h1>
</template>

<script>
export default {
  props: ['color', 'fontSize']
}
</script>

<style scoped>
h1 {
  color: eval("color");
  font-size: eval("fontSize * 2");
}
</style>

Out:

<template>
  <h1 :style="{'--v0': color, '--v1': fontSize * 2}">hello</h1>
</template>

<script>
export default {
  props: ['color', 'fontSize']
}
</script>

<style scoped>
h1 {
  color: var(--v0);
  font-size: var(--v1);
}
</style>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
IniZiocommented, Jan 9, 2019

or maybe interpolation like

<style scoped>
h1 {
  color: {{ color }};
  font-size: {{ fontSize * 2 }};
}
</style>

?

Edit: Not friendly for editors since it is invalid css

1reaction
danielwaltzcommented, Jan 14, 2019

I like this concept. I’m way more willing to adopt this method if I can continue using the style block in my SFCs.

Perhaps setting a new type will help make it more obvious to fresh eyes on the project what’s going on too. Like <style lang="styled" scoped> or something like that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Style Hacks that Will Change Your Life | by Erin Elizabeth
Hi guys! Today I'm sharing with you a few of my styling hacks / fashion hacks ! These are 5 really simple things...
Read more >
QUICK FASHION HACK | YOU WILL TURN HEADS w/o EVEN ...
Happy holiday fam! These are some quick fashion hacks that will make you turn heads and the best part is its effortless. Let's...
Read more >
Styling Hacks Everyone Should Know | Get the Most Out of ...
This week i'm sharing style tips and fashion hacks I think I EVERY girl ... Let me know which style and fashion hack...
Read more >
Xkcd Style Sql Injection Hack in Python
We have created a simple database. Now let's hack it. Xkcd style hack on our database. #!/usr/bin/python3 import sqlite3 db = ".
Read more >
Sleeve Hacks - Melly Sews - Pinterest
Hack a sleeve design - how to change the style of a sewing pattern - Melly. mellysews · Melissa (Melly Sews) ... Let's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found