stylus 为啥要加入 ~ @import '~common/stylus/mixin'
2017-10-23 16:23
162 查看
仔细查看了stylus的api: https://github.com/shama/stylus-loader
and then
also take advantage of webpack's resolve options. With the default options it'll find files in
well as
For example if you have a styles package lookup files in it like
It can also find stylus files without having the extension specified in the
index files in folders if webpack is configured for stylus's file extension.
will let you have an
Be careful though not to use the extensions configuration for two types of in one folder. If a folder has a
a
相信大家看懂了!
and then
require('./file.styl');will compile and add the CSS to your page.
stylus-loadercan
also take advantage of webpack's resolve options. With the default options it'll find files in
web_modulesas
well as
node_modules, make sure to prefix any lookup in node_modules with
~.
For example if you have a styles package lookup files in it like
@import '~styles/my-styles.
It can also find stylus files without having the extension specified in the
@importand
index files in folders if webpack is configured for stylus's file extension.
module: { resolve: { extensions: ['', '.js', '.styl'] } }
will let you have an
index.stylfile in your styles package and
require('styles')or
@import '~styles'it. It also lets you load a stylus file from a package installed in node_modules or if you add a modulesDirectories, like
modulesDirectories: ['node_modules', 'web_modules', 'bower_components']option you could load from a folder like bower_components. To load files from a relative path leave off the
~and
@import 'relative-styles/my-styles';it.
Be careful though not to use the extensions configuration for two types of in one folder. If a folder has a
index.jsand
a
index.styland you
@import './that-folder', it'll end up importing a javascript file into your stylus.
相信大家看懂了!
相关文章推荐
- less @import and extend及mixin详解
- 2.sass变量、嵌套、混合(mixin)、继承拓展、@import、comment
- 给django view加上 import file mixin
- pycharm加入import路径
- 自動加入import -- Android Studio ctrl shit o
- PROC预编译时加入 COMMON_PARSER=YES 选项,支持预编译分析函数(比如 ROW_NUMBER 和 OVER)
- import com.google.common.* 出错,找不到
- java中import 与c/c++中的include
- C#字段中加入list<类字段> 的两种写法
- ZT,MYSQL加入微软VS工业伙伴队伍,可以使用VS2005管理MYSQL数据库了
- Limo_Os_桌面开发_加入农历_教程
- bat文件加入windows定时任务运行返回错误代码0x1
- Longest Common Prefix
- 236. Lowest Common Ancestor of a Binary Tree
- 博客技巧----如何加入透明Flash背景
- 错误记录--The import XXX cannot be resolved
- 在Unity3d编辑器中加入菜单以及菜单项
- swift-辞典NSDictionary定义,变化的关键,删/加入关键
- 加入attention机制的image caption问题
- 开发人员一定要加入收藏夹的网站