add globstar (asterisk) support for imports
See original GitHub issueIt would be really nice if we could use globstars to import directories of stylus files.
For example, with a directory structure like this (from an animate.css port):
βββ flippers
βΒ Β βββ flip.styl
βΒ Β βββ flipInX.styl
βΒ Β βββ flipInY.styl
βΒ Β βββ flipOutX.styl
βΒ Β βββ flipOutY.styl
βββ lightspeed
βΒ Β βββ lightSpeedIn.styl
βΒ Β βββ lightSpeedOut.styl
βββ rotating_entrances
βΒ Β βββ rotateIn.styl
βΒ Β βββ rotateInDownLeft.styl
βΒ Β βββ rotateInDownRight.styl
βΒ Β βββ rotateInUpLeft.styl
βΒ Β βββ rotateInUpRight.styl
βββ rotating_exits
βΒ Β βββ rotateOut.styl
βΒ Β βββ rotateOutDownLeft.styl
βΒ Β βββ rotateOutDownRight.styl
βΒ Β βββ rotateOutUpLeft.styl
βΒ Β βββ rotateOutUpRight.styl
βββ sliders
βΒ Β βββ slideInDown.styl
βΒ Β βββ slideInLeft.styl
βΒ Β βββ slideInRight.styl
βΒ Β βββ slideOutLeft.styl
βΒ Β βββ slideOutRight.styl
βΒ Β βββ slideOutUp.styl
βββ specials
β βββ hinge.styl
β βββ rollIn.styl
β βββ rollOut.styl
βββ package.json
βββ bower.json
βββ README.md
We could use @import 'animate.css/*'
to import everything in the library, or @import 'animate.css/sliders/*'
to get only the sliders, or @import 'animate.css/sliders/slideInDown'
to get only the slideInDown animation.
I know that we can do this already by adding an index.styl to each folder with a list of @import
s for files in that folder. However, that requires a lot of extra files that need to be kept in sync with any removals or additions to the directory they are in.
Edit: as @jasonkuhrt mentions below, we could use https://github.com/isaacs/node-glob for the implementation.
Issue Analytics
- State:
- Created 10 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
What double ** do in an import? - Stack Overflow
A double asterisk translates to any character, which means not only file names but also directories are taken into account (and so ....
Read more >Working with Globs | Forestry.io
Two asterisks in sequence ( ** ) is known as a globstar and will match 0 or more subdirectories in the path.
Read more >How to enable the double star ** (globstar) operator?
1 Answer 1 ; echo $BASH_VERSION 4.4.12(1)-release. Check if it is enabled via: ; shopt globstar. It defaults to off . If you...
Read more >path/filepath: Glob should support ** for zero or more ... - GitHub
Go version 1.4.2 Mac OS X 10.10 Example: package main import "fmt" import "path/filepath" import "os" func main() { files, err := filepath....
Read more >glob β Unix style pathname pattern expansion ... - Python Docs
This function can support paths relative to directory descriptors with the dir_fd parameter. If recursive is true, the pattern β ** β will...
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 Free
Top 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
And even if they would be supported, we canβt use glob patterns there because we donβt have full access to the filesystem in client side JS.
Is this possible using the client side version of stylus? Because Iβm getting an error βglob is not definedβ. Thanks.