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.

Alias in css don't work ?

See original GitHub issue

Describe the bug

I’ve use alias but it seem not work in style

Reproduction

in vite.config.js

export default {
  alias: { '/~/': require('path').resolve(__dirname, 'src') },
}

in App.vue alias work in script

<script>
import { test } from '/~/Settings.js'
<script>

But don’t in style

<style>
@import '/~/css/Global.css'
</style>

System Info

  • required vite version: v1.0.0-rc.3
  • required Operating System: Linux
  • required Node version: v12.11.1
  • Optional:
    • npm/yarn version 1.12.3
    • Installed vue version (from yarn.lock or package-lock.json) 3.0.0-rc.4
    • Installed @vue/compiler-sfc version 3.0.0-rc.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Niputicommented, Apr 19, 2021

@oleksii-shaposhnikov you should ask questions in discord chat https://chat.vitejs.dev/ or at https://github.com/vitejs/vite/discussions instead of in old closed issues

0reactions
oleksii-shaposhnikovcommented, Apr 19, 2021

@yyx990803 so how to import scss correctly like in the example in the description?

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to alias class name in css or sass - Stack Overflow
There's no such thing as aliasing. Sass does have the @extend directive, but the solution isn't entirely obvious until you look into the ......
Read more >
Webpack aliases not resolved in URLs in CSS properties
This works fine and everybody is happy. However, when I use a webpack alias module and import an URL using the ~ syntax,...
Read more >
CSS antialiasing cheatsheet - Devhints
One-page guide to CSS antialiasing: usage, examples, and more. Here's a 4-line snippet on how to get beautiful, antialiased text with CSS.
Read more >
font-smooth - CSS: Cascading Style Sheets - MDN Web Docs
The font-smooth CSS property controls the application of anti-aliasing when fonts are rendered.
Read more >
8 Working With Global Selector Aliases - Oracle Help Center
The keyword :alias identifies your global selector alias as a CSS pseudo-class and serves as a syntax aid to organize the CSS code...
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