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.

Import CSS file into stylus

See original GitHub issue

Maybe I’m missing something in the docs, but is there a way to include a CSS file into a my Stylus project? I have a folder of CSS files from plugins that I use, and I’d rather not edit them so that they are Stylus-compatible every time I update them. I thought @import 'file.css' would work, but it’s a literal import that I would never want to use.

Thank you!

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
kizucommented, Jun 20, 2012

@jonathanong have you tried the --include-css cli option? I think it does exactly what you need — includes the content of the .css files as is.

0reactions
kizucommented, Nov 28, 2013

@kalisjoshua

  1. You can use the -r, --resolve-url flag to resolve the urls relative to the stylus file.
  2. Yep, and in the bright future the compress option would be completely removed from Stylus — it is not a preprocessors’ task to minify files, there are proper other tools for this task.

However, I agree that it could be useful to have the same things those keys do, but as bifs — so you could choose what to inline and how to resolve urls per import.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@import and @require | Stylus
Stylus supports both literal @import for CSS, as well as dynamic importing or requiring of other Stylus sheets. Literal CSS #. Any filename...
Read more >
import regular css · Issue #448 · stylus/stylus - GitHub
The ability to quickly import vendor .css files (i.e. for a plugin like fancybox) would be helpful and reduce every-day-friction with stylus.
Read more >
Make Stylus merge imported CSS into the stylesheet
I have found how to switch this option on: gulp.src('./app/styl/style.styl') .pipe(stylus({ 'include css': true })) .pipe(gulp.dest('.
Read more >
5 Importing and Globbing Stylus Files - YouTube
Learn how to use @ import to import .styl files with the Stylus CSS pre-processor.Subscribe to Level Up Pro for extra ...
Read more >
Languages: Stylus - CodeKit
Include CSS Imports. When enabled, the contents of a CSS file that you @import in your Stylus file will replace the import statement...
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