Using Meteor + Stylus, how do you import a file in another folder starting from the root?

Given:

/css/colors.styl /home/home.styl

I know I can use @import '../css/colors' but it gets messier the deeper it goes. Is there a way to do something like @import '/css/colors'?

有帮助吗?

解决方案

Starting in meteor 1.2, you can import a .styl file relative to your application's root directory with the following syntax:

@import '{}/client/imports/colors.styl'

See the package documentation for more details. Also note:

The package processes all .styl files, treating .styl as entry points and all files with extension .import.styl or a file in under an imports folder as an import.

So putting your imports under a directory with imports in the name is a good idea.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top