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.

Support for Vue SFC (Single File Components).

A Vue SFC is a file like the following:

<template>
  <div class="d-flex">Hello</div>
</template>
<script>
export default {}
</script>
<style>
.d-flex {
  display: flex;
}
</style>

As we can see, there’s a tag called style that can contain css and other pre-processors, such as scss.

The style tag accepts css code by default, or the extension specified by the lang attribute. Example:

<style lang="scss">
/* ... */
</style>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
paustintcommented, Jun 1, 2019

@MegaMattMiller - I have opened a PR that adds support for HTML/Vue/Svelte. Would you mind pulling the PR down and testing it to make sure it works? I am not a Vue developer, so I am not sure of all the patterns that are used aside from what I saw in the documentation.

PR: #21

If you are able to try it out, please let me know if you have any questions or find any issues.

Here was the file I used for testing

<template>
  <nav class="navbar navbar-light">
    <div class="container">
      <router-link class="navbar-brand" :to="{ name: 'home' }">conduit</router-link>
      <ul v-if="!isAuthenticated" class="nav navbar-nav pull-xs-right">
        <li class="nav-item">
          <router-link class="nav-link" active-class="active" exact :to="{ name: 'home' }">Home</router-link>
        </li>
        <li class="nav-item">
          <router-link class="nav-link" active-class="active" exact :to="{ name: 'login' }">
            <i class="ion-compose"></i>Sign in
          </router-link>
        </li>
      </ul>
    </div>
  </nav>
</template>

<script>
import { mapGetters } from 'vuex';

export default {
  name: 'RwvHeader',
  computed: {
    ...mapGetters(['currentUser', 'isAuthenticated'])
  }
};
</script>

<!-- Using the `scoped` attribute -->
<style scoped>
.button {
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
}

.button-close {
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
  margin: 1 0 0 0;
  padding: 2 0 0 0;
}
</style>

<!-- Using CSS modules -->
<style module>
.button {
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
}

.buttonClose {
  background-color: red;
}
</style>

<style>
.c-Button {
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
}

.c-Button--close {
  background-color: red;
}
</style>
2reactions
Raathigeshcommented, May 30, 2019

This would be nice to have and should be fairly easy to do. If anybody wants to give it a shot, ping below and I’m more than happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooling - Vue.js
Vite is a lightweight and fast build tool with first-class Vue SFC support. It is created by Evan You, who is also the...
Read more >
Single-File Components - Vue.js
IDE support with auto-completion and type-checking for template expressions; Out-of-the-box Hot-Module Replacement (HMR) support. SFC is a defining feature of ...
Read more >
SFC Syntax Specification - Vue.js
A Vue SFC is syntactically compatible with HTML. Each *.vue file consists of three types of top-level language blocks: <template> , <script> ...
Read more >
Vue Single-File Component (SFC) Spec - Vue Loader
vue -loader supports using non-default languages, such as CSS pre-processors and compile-to-HTML template languages, by specifying the lang attribute for a ...
Read more >
<script setup> | Vue.js
<script setup> is a compile-time syntactic sugar for using Composition API inside Single-File Components (SFCs). It is the recommended syntax if you are ......
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