stylus

Setting up auto compile for Stylus

只愿长相守 提交于 2020-01-20 18:28:07
问题 I have installed node.js/stylus/nib on my mac and I can manually compile .styl file to .css on the command line. I also know there is this stylus.middleware() things that keeps coming up when I search for how to setup auto-compiling when the .styl changes, however I have no idea how I am supposed to implement it (I have never used node.js before). What file do I put that code in? How do I start this code so it is always run? I think I am missing a few things on the node side to be able to set

使用Vue框架开发去哪儿旅游网移动端实战项目(六)

会有一股神秘感。 提交于 2020-01-20 04:20:58
第六章 旅游网站首页开发 首页导航栏 根据设计稿完成页面的布局: 在正式编写代码之前,先来介绍一下 stylus 这是一种与 less、sass 一样的功能,可以帮助我们快速完成css代码的编写。请使用一下命令进行安装: npm install stylus --save npm install stylus-loader --save 开始编写 header 页面: < template > < div class = " header " > < div class = " header-left " > 返回 </ div > < div class = " header-input " > 输入城市景点/游玩/主题 </ div > < div class = " header-right " > 城市 </ div > </ div > </ template > < script > export default { name : 'HomeHeader' } </ script > <!-- 要使用stylus使用lang标识,只想对当前组件有效使用scoped --> < style lang = " stylus " scoped > .header display : flex color : #fff background : #00bcd4 line

Optimize css with stylus

三世轮回 提交于 2020-01-05 05:55:35
问题 I have such css: p{ margin: .85em auto; line-height: 1.7; text-indent: 2em; } blockquote p { text-indent: 0; } Is there any way to optimize that using stylus? Just to do something like that: p{ margin: .85em auto; line-height: 1.7; (not if blockquote) text-indent: 2em; } HTML I am trying to apply that to <div class="entry"> <p></p> //text-indent here <blockquote> <p></p> //no text-indent here </blockquote> </div> 回答1: Stylus can't read the HTML to know if you have a blockquote wrapping the p

expressjs - not able to load my stylus stylesheet to jade html page

你离开我真会死。 提交于 2020-01-05 03:05:25
问题 In my express app, i am trying to load the style properties from styles module engine. But i couldn't able to load my style at all. here is my folder structure: myNodeApp -node_modules -styles -style.css -style.styl -views -index.jade and here is my app.js code where i call use the stylus. var http = require("http"), express = require("express"), stylus = require("stylus"), app = express(); app.set('view engine', 'jade'); app.set('views', './views'); app.use(stylus.middleware({ debug : true,

A lot of warnings with webpack uglify

*爱你&永不变心* 提交于 2020-01-03 09:07:52
问题 When I'm running webpack uglify plugin and I'm getting a lot of warnings from the stylus loader / css-loader. How can I resolve them? The webpack bundles it successfully. Condition always true [./~/style-loader!./~/css-loader!./~/stylus-loader!./app/<filename>.styl:10,0] 回答1: That's normal -- by default Uglify tells you about the dead code that it strips out. If you don't want those "warnings" output, you can configure the plugin not to: new Webpack.optimize.UglifyJsPlugin({ compress: {

在Vue.js中使用Stylus预处理器

我怕爱的太早我们不能终老 提交于 2019-12-30 04:30:23
1.安装stylus和loader $npm install stylus stylus-loader --save-dev 2.webpack配置(红色部分) module: { rules: [ { test: /\.css$/, use: [ 'vue-style-loader', 'css-loader', ], }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: { } // other vue-loader options go here } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.(png|jpg|gif|svg)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }, { test:/\.styl$/, //add(stylus) loader: 'style-loader!css-loader!stylus-loader' } ] }, resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js' }, extensions: ['*', '.js'

样式处理——预处理器stylus

拈花ヽ惹草 提交于 2019-12-30 04:26:18
前提说明 为了写样式方便快速,现在很多时候写样式都是使用预处理器了,预处理器有很多,包括 Sass、Less、Stylus 等。在这里选用的预处理器是 Stylus。 需要用到的模块: stylus stylus-loader 文件的后缀名: .styl 准备工作 首先,还是把需要的依赖安装一下 package.json : "scripts": { "webpack": "webpack" }, "devDependencies": { "css-loader": "^1.0.0", "mini-css-extract-plugin": "^0.4.2", "stylus": "^0.54.5", "stylus-loader": "^3.0.2", "webpack": "^4.17.1", "webpack-cli": "^3.1.0" } 其次,就是准备 Webpack 的配置文件 webpack.config.js ,当然,这个配置文件是一部分: const { join, relative } = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const config = {}; config.mode = 'production'; config

stylus之样式穿透

大憨熊 提交于 2019-12-25 15:29:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 话不多说,直奔主题。 我们为什么要用样式穿透? 因为有<style lang="stylus" scoped >中的 scoped 会限制我们去改变除当前这个组件以外的样式。举个例子,请结合图片来看例子哦。🙂 .wrapper 是小编在项目里定义的一个类名。 .swiper-pagination-bullet-active 是 类名.wrapper下的子级。 >>> 样式穿透 .wrapper >>> .swiper-pagination-bullet-active 如: 所有wrapper里面所有子组件只要出现 swiper-pagination-bullet-active,就让它都变成红色。 ^_^乍一听,像不像一个下一个咒。 相信写过项目的小伙伴们都看到过! 它表示优先最高。 background red !important 设置router.js页面路由的核心代码: 找到 router.js文件打开。 像这两句是固定要写的: import Vue from 'vue' import Router from 'vue-router' 而像 : import Home from '@/pages/home/Home' import Home from '@/pages/city/City'

How to iterate through a double for loop in Stylus

两盒软妹~` 提交于 2019-12-25 06:28:48
问题 I'm trying to use a double for loop to create 16 css selectors that shift a background-position through each one in a grid. I have the background-position printing correctly, but I can get the class to spit out 1-16. In the example below, index would be replace by the correct solution. I tried creating a variable and adding one each time through the loop, but it returns and error. for row in 1 2 3 4 for col in 1 2 3 4 li.item{index} background-position (((row - 1) * 130 + ((row - 1) * 2)) *

Bootstrap CSS overwriting my custom CSS

旧巷老猫 提交于 2019-12-25 05:15:18
问题 I am using Twitter Bootstrap's CSS and for some reasons it overwrites some of my classes. First I load it before my custom CSS (I am using jade and stylus template engines): HTML header: doctype html html head title= title link(rel='stylesheet', href='/css/vendor/bootstrap.min.css') link(rel='stylesheet', href='/css/style.css') in my HTML body: table.table.table-striped thead th some items th some items th some items tbody tr td.table__td a.table__link(href='/') some items tr td.table__td a