【问题标题】:What bootstrap-styl do?引导样式做什么?
【发布时间】:2016-10-27 11:47:52
【问题描述】:

我在页面上使用 express、bootstrap-styl、stylus、nib 和 pug/jade

我的服务器代码

var express=require('express')
var boostrap=require('bootstrap-styl')
var stylus=require('stylus')
var nib=require('nib')
var pug=require('pug')

var app=express()
app.use(express.static('public'));
app.use(stylus.middleware({
    src: 'public',
    compile: compile
}))
app.set('views', './views'); 
app.set('view engine', 'pug');

function compile(str,path){
    return stylus(str)
    .set('filename',path)
    .set('compress',true)
    .use([boostrap(),nib()])
}

app.get('/',function(req,res){
    //res.send('Hello Hola')
    res.render('index',{msg:'my message'})
})

app.listen(80)

我的玉码

doctype html5
html
    head
        link(rel='stylesheet',href='/style/style.css')
    body
        =msg
        input(type=text)
        button.btn.btn-warning(type='button') Click

我的按钮没有用 bootstrap 设置样式,bootstrap-styl 到底是做什么的?


我的错,我没有在 style.styl 导入引导程序

@import 'nib'
@import bootstrap
body
    background-color red

【问题讨论】:

标签: javascript node.js twitter-bootstrap pug stylus


【解决方案1】:

尝试使用 bootstrap-stylus 代替 bootstrap-syl...

`var bootstrap = require('bootstrap-stylus'), 手写笔 = 要求(“手写笔”); 函数编译(str,路径){ 返回手写笔(str) .set('文件名', 路径) .use(bootstrap()); } app.use(stylus.middleware({ src: __dirname + '/public', 编译:编译 }));`

【讨论】:

    猜你喜欢
    • 2021-08-16
    • 2016-07-07
    • 1970-01-01
    • 1970-01-01
    • 2014-03-06
    • 2014-05-16
    • 2018-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多