[Bug Report] stylus block level import not working
See original GitHub issueThis issue is a continuation of https://github.com/vuetifyjs/vuetify/issues/1902#issuecomment-399030552
Versions and Environment
Vuetify: 1.1.10 Vue: 2.5.17 Browsers: n/a OS: Linux
Steps to reproduce
using a stylus block level import:
src/stylus/main.styl
.myapp
#import '~vuetify/src/stylus/main'
This is to ensure that the vuetify css doesn’t interfere with elements from other parts of the page which aren’t using vuetify.
Expected Behavior
no error, styles are scoped with the block
Actual Behavior
ERROR Failed to compile with 1 errors 2:13:28 pm
error in ./src/stylus/main.styl
Module build failed (from ./node_modules/stylus-loader/index.js):
Error: node_modules/vuetify/src/stylus/settings/_el
evations.styl:85:33
81| 0px 9px 46px 8px $shadow-key-ambient-opacity
82|
83| // MIXINS
84| elevation($z, important = false)
85| box-shadow: $shadow-key-umbra[$z],
---------------------------------------^
86| $shadow-key-penumbra[$z],
87| $shadow-key-ambient[$z] (important ? !important : )
88|
cannot perform $shadow-key-umbra[((0))]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:6 (1 by maintainers)
Top Results From Across the Web
import and @require - Stylus Lang
Stylus supports block-level import. It means that you can use @import not only at root level, but also nested inside other selectors or...
Read more >Reading bug reports | Android Open Source Project
Android bug reports contain dumpsys , dumpstate , and logcat data in text (.txt) format, enabling you to easily search for specific content....
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug :1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance ... seg fault/kernel not syncing block in kernel 2.6.27-2.6.28" status:RESOLVED ...
Read more >Flyspray::All Projects: Tasklist - QCAD
Flyspray, a Bug Tracking System written in PHP. ... 1008, QCAD Bugtracker, QCAD (main), Bug Report, Low, DXF (dxflib) compat issues, Assigned, Tamas...
Read more >Xournal User's manual - SourceForge
The background of the page (and the lower layers) are not erased. Whiteout: the eraser is actually a thick white pen, and simply...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing as we’re moving to sass
It would seem the problems comes from webpack rather than stylus itself or vuetify itself. I encountered the exact same problem under the same circumstances (nesting the entire vuetify style under an #id in order to prevent vuetify styles override).
I messed around a bit in the vuetify core
*.styl
file and it would seem (based on the other errors I managed to get) that when you do a “block level import”, the imported*.styl
files are not well evaluated and the “raw” content is returned.I managed to get some this error at some point :
As you can see here, the
color
variable here seems to be the “raw” call to the function.Since I know exactly nothing about webpack, I’m not really sure if that’s a lead. Maybe someone will be able to dig a bit deeper with these new elements. Please note that I am using this loader for webpack : https://github.com/shama/stylus-loader and that I’m managing my project with
vue-cli
(which basically hides everything from webpack).That being said, the only way I found to avoid the issue was to build my custom
main.styl
using stylus itself and include the resulting file in my main js file.The neat thing is that
stylus
has a--watch
option that works pretty well with the--watch
option of thevue-cli-service build
command. Launch the watch onstylus
:In another shell, the
vue-cli-service
:Then include your compiled
main.css
in yourvue
file and it should properly cascade when you modify your custommain.styl
file.I hope this helps some folks.