stylus

基础路由的设置——使用vue-router实现导航切换

依然范特西╮ 提交于 2019-12-06 04:16:01
1.vue-router的安装。 命令行中进入项目所在文件位置【重要】,输入: npm install vue-router 安装完成后在项目文件中的package.json中可以看到vue-router的版本信息。 2.在 App.vue中 定义<router-link> 和 <router-view>     在vue-router中, 我们看到它定义了两个标签 <router-link> 和 <router-view> 分别对应点击和显示部分。     <router-link> 就是定义页面中点击的部分,<router-link> 还有一个非常重要的属性 to,定义点击之后,要到哪里去, 如:<router-link to=”/home”>Home</router-link>     <router-view> 定义显示部分,就是点击后,区配的内容显示在什么地方。 App.vue代码: < template > < div > < v-header :seller = "seller" > </ v-header > < div class = "tab border-1px" > < div class = "tab-item" > <!-- router-link 定义点击后导航到哪个路径下 --> < router-link to = "/goods" > 商品 </

Does Stylus support arrays of variables?

我的未来我决定 提交于 2019-12-05 12:06:41
I can't find in the docs an example of using arrays as variables. It would be obvious though to have arrays support so I suspect I should search for that in a different way. I have found lists, but not sure if these are intended for the same or similar purpose as arrays and couldn't find syntax and examples. I have a list of colors - cards_colors = #E0137E #8431BF #2388C4 #FED462 #EC633B #B3CF32 #2388C4 #EA8527 And I want to assign each color to a respective element in a loop, similar to this: for num in (0..10) &.card-{num} background cards_colors[{num}] using a list works for me: cards

CSS 预处理器 Stylus分享

前提是你 提交于 2019-12-04 23:26:07
CSS 预处理器 Stylus分享 ps:为了分享,内容东拼西凑,并非原创,很多参考了 张鑫旭大大翻译的中文文档。这里放上两个不错的stylus链接: https://github.com/leeseean/stylus-style-guide github stylus语法规范 http://blog.hooperui.com/561-2/ 预处理器的作用ect 写的很好。。 一、简介 由于原生css有一些缺陷, 一些CSS预处理器应运而生 使用最多的是 变量(variables),代码混合( mixins),嵌套(nested rules)以及 代码模块化(Modules)。 复用,逻辑能力和抽象能力。 Stylus 相较于SASS更加简洁,甚至冒号也都可以省略,初学Stylus时感到它太神奇了,仅仅以空格分隔属性名和多个属性值就可以生成想要的CSS, 而且还可以拼接字符串等等 。与此同时,类似Ruby或Python完善的缩进语法,Stylus在简约自由中有效的防止了语法歧义。 安装 npm install stylus --save 例子 Stylus由Javascript编译,其结构语句也和Javascript相差不多。Stylus较之LESS则要优越不少,不仅仅是可定义变量,如Javascript般的条件语句和循环语句也为Stylus带来各种可能,加上丰富的内置函数

How to use stylus block level import with Vuetify styles

隐身守侯 提交于 2019-12-04 17:08:52
Using a stylus block level import: # vuetify-style.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. But unfortunately it doesn't work, I can't compile it. 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 =

Can I set gulp livereload to run after all files are compiled?

吃可爱长大的小学妹 提交于 2019-12-04 09:21:24
I've got a gulp set up to work with Stylus, Jade and tiny-lr. My problem is that when I save one jade file, it start's compiling them all, therefore live reloading fires on the first file copied to the destination, before the file I am working on currently is compiled, resulting in me having to refresh manually. I have fixing this issue using "gulp-changed" but I don't seem to be able to configure it or something. Anyone had this problem before? I am posting my Gulp file so you can take a look. A timeline diagram of the problem can be found here: https://www.dropbox.com/s/3g37oy25s9mq969/jade

How to configure Stylus support in a React.js application?

我们两清 提交于 2019-12-04 07:20:06
I want the classes in my React.js application to be available for export from .styl -files in the same way as it can be done from CSS Modules, but I can't find any ready-made solution to this problem. I found a guide to setting up CSS Modules in an application created with Create React App. I understand that you need to run npm run eject and somehow rewrite configuration files, but how – I don't understand. You need to install next npm-packages in your project: stylus stylus-loader css-loader In webpack.config, in section module you need to add next points: { test: /\.styl$/, use: [ 'style

如何在vue项目中使用stylus

佐手、 提交于 2019-12-03 13:16:48
  安装步骤基于使用vue-cli创建的项目:     创建完一个初始项目后,通过 npm install css-loader style-loader -D     再安装stylus:通过     npm install stylus --save-dev                 npm install stylus-loader --save-dev     然后在build--->webpack.base.config.js中配置规则:      {         test: /\.css$/,         loader:''style-loader!css-loader!stylus-loader'       }   可能完成上述步骤仍然会出错:     cannot find module 'stylus'     原因是在webpack里面可能还是没有正确安装依赖,就再次安装就好了;       npm install stylus --save-dev       npm install stylus-loader --save-dev       再次运行项目的时候,就可以了; 来源: https://www.cnblogs.com/hou-yuan-zhen/p/11796493.html

Load variables into LESS CSS preprocessor from JSON file

不问归期 提交于 2019-12-03 05:38:15
Is it possible to load variables into LESS CSS preprocessor from a JSON file like you can do with Stylus? With contents of file myvars.json { "color1": "#112345", "color2": "#667890" } In Stylus I do... json('myvars.json') body{ background-color: color1; } Is it possible to do this in LESS? I want to keep the file as JSON, so I can easily re-use it in javascript. Martin Turjak In less.js you can make use of javascript interpolation (using the back-ticks). And call a function that loads the json object with the variables from the file ... from which you can extract the variable by its key -

Stylus Iteration + Interpolation with nth-of-type

匿名 (未验证) 提交于 2019-12-03 01:44:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm attempting to use the counter provided when looping thru a list of items like so: colors = red blue orange green yellow li for color, i in colors &:nth-of-type({i}n) background-color: color This example does not work, but the intended output I'm looking for is: li:nth-of-type(1n) { background-color: red; } li:nth-of-type(2n) { background-color: blue; } li:nth-of-type(3n) { background-color: orange; } ... Is this possible? 回答1: Actually your example's output is almost correct. It starts with 0 and you need 1, so this should work: colors =