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

Question: how to import 3rd party stylus libraries? #1976

Open
shaunc opened this issue Oct 24, 2019 · 6 comments
Open

Question: how to import 3rd party stylus libraries? #1976

shaunc opened this issue Oct 24, 2019 · 6 comments
Labels
complexity: easy Easy complexity contribution welcome Contributions welcome good first issue Good for newcomers

Comments

@shaunc
Copy link

shaunc commented Oct 24, 2019

I just tried to install normalize-styl. After install, it suggests that I can use simply by @import 'normalize'. I included this in .vuepress/styles/index.styl, but it didn't work.

Do I have to do some extra configuration somewhere? Perhaps instructions or link could be put in the doc under styling?

@shaunc
Copy link
Author

shaunc commented Oct 24, 2019

Ok ... with some random experimentation and consultation of the stylus-loader package doc, the following works:

@import '~normalize-styl'

I'll leave the issue open, though; I think the documentation should be improved to mention the tilde as many VuePress users might not be familiar with stylus-loader.

@Mister-Hope
Copy link
Contributor

Sounds like you are not familiar with vue or webpack. Any module needs to begin with a ~ to let webpack know it is a module.Or it will also think it is a relative path try to find it in same folder. Besides, webpack first resolve the module amd let them imported, then call the loader to do the job. SO you can't think webpack can import can load fole at the same time.It musr import first then call the loader. So in my opinion, it's not a confusing thing.

@shaunc
Copy link
Author

shaunc commented Oct 26, 2019

Well first of all I'm not familiar with stylus ... or how closely its integrated with other tools. If I put @import 'normalize' in a stylus file, I have no idea how that relates to actual paths and I had assumed there is some stylus config specific to vuepress (presumably involving webpack) that sets defaults. After all, if I find in a package that @import 'normalize' should load from node_modules, I don't necessarily know that webpack is munging -- it could be that stylus collects everything together beforehand based on its own configuration.

It might be good to put in the VuePress doc under styling a link to the stylus loader doc.

@Mister-Hope
Copy link
Contributor

What about less or sass? They also need ~ 😄 If you are not familiar with css pre-proccessors, maybe you should first have a look at them?

@kefranabg
Copy link
Collaborator

As @shaunc said, I think it would be great to improve documentation with an example on this topic.

Contributions welcome !

@kefranabg kefranabg added complexity: easy Easy complexity contribution welcome Contributions welcome good first issue Good for newcomers labels Nov 6, 2019
@evenlasting
Copy link

I will try to take this as my first issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: easy Easy complexity contribution welcome Contributions welcome good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants