Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostCSS import, and documentation #1725

Closed
2 tasks done
Sharlaan opened this issue Jan 26, 2021 · 3 comments
Closed
2 tasks done

PostCSS import, and documentation #1725

Sharlaan opened this issue Jan 26, 2021 · 3 comments

Comments

@Sharlaan
Copy link

Sharlaan commented Jan 26, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)

Describe the bug

Same as #1629
I am trying to @import an empty theme.css file from src/ using (see Reproduction)

The Vite docs are pretty scarce on syntax/plugins to install/write.
I initially supposed that lang="postcss" is not required ?
same for installing postcss and/or postcss-import libraries ?
same for the postcss.config.js file ?

I have tried adding all the above but still get this error (see Logs section)
Vite seems unable to resolve @import word, despite #1629 saying it is fixed/merged ?

I am honestly clueless on what is preventing Vite to recognize @import keyword, which is extremely commonly used.

Reproduction

// App.vue
<style>
@import './theme'

</style>

System Info

  • vite version: ^2.0.0-beta.49
  • Operating System: Windows10
  • Node version: 15.6
  • Package manager (yarn) and version: 1.22.10

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.

image

@Sharlaan
Copy link
Author

Sharlaan commented Jan 26, 2021

EDIT#1:

Just initialized a bare vite project using vue-ts template,
installed postcss-import lib
added postcss.config.js with declaring the postcss-import plugin
transfered the #app css rule from App.vue into a src/theme.css file
Used @import './theme' in App.vue

... and it works o.O

EDIT#2

I found what were the problem :

the imported theme.css were "empty" in the way i commented all lines with //
=> Unknown word error

Solution: problem solved replacing these symbols with /* */

Nonetheless, it would be nice to add in docs postcss.config.js is required for any plugin, with an example using postcss-import

@yyx990803
Copy link
Member

You don't need to install anything and @import just works out of the box inside all CSS, including <style> of Vue SFCs.

@532815096
Copy link

@Sharlaan
It doesn't work for me...
image
image
has none // ......
so, what can i do next?

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants