Tôi không thể hiển thị ít css hơn trong không gian làm việc nhanh.
Dưới đây là cấu hình hiện tại của tôi (css/ít tác phẩm của tôi là trong 'công cộng/Stylo /'):Node.js + Express.js. Làm thế nào để RENDER ít css?
app.configure(function()
{
app.set('views' , __dirname + '/views' );
app.set('partials' , __dirname + '/views/partials');
app.set('view engine', 'jade' );
app.use(express.bodyDecoder() );
app.use(express.methodOverride());
app.use(express.compiler({ src: __dirname + '/public/stylo', enable: ['less']}));
app.use(app.router);
app.use(express.staticProvider(__dirname + '/public'));
});
Đây là tôi tập main.jade:
!!!
html(lang="en")
head
title Yea a title
link(rel="stylesheet", type="text/css", href="/stylo/main.less")
link(rel="stylesheet", href="http://fonts.googleapis.com/cssfamily=Droid+Sans|Droid+Sans+Mono|Ubuntu|Droid+Serif")
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js")
script(src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js")
body!= body
đây là của tôi main.less css:
@import "goodies.css";
body
{
.googleFont;
background-color : #000000;
padding : 20px;
margin : 0px;
> .header
{
border-bottom : 1px solid #BBB;
background-color : #f0f0f0;
margin : -25px -25px 30px -25px; /* important */
color : #333;
padding : 15px;
font-size : 18pt;
}
}
VÀ đây là goodies.less tôi css:
.rounded_corners(@radius: 10px)
{
-moz-border-radius : @radius;
-webkit-border-radius: @radius;
border-radius : @radius;
}
.shadows(@rad1: 0px, @rad2: 1px, @rad3: 3px, @color: #999)
{
-webkit-box-shadow : @rad1 @rad2 @rad3 @color;
-moz-box-shadow : @rad1 @rad2 @rad3 @color;
box-shadow : @rad1 @rad2 @rad3 @color;
}
.gradient (@type: linear, @pos1: left top, @pos2: left bottom, @color1: #f5f5f5, @color2: #ececec)
{
background-image : -webkit-gradient(@type, @pos1, @pos2, from(@color1), to(@color2));
background-image : -moz-linear-gradient(@color1, @color2);
}
.googleFont
{
font-family : 'Droid Serif';
}
mát thỏa thuận. Bây giờ: Tôi đã cài đặt ít hơn qua npm và tôi đã nghe từ một bài đăng khác mà @imports nên tham khảo .css
không phải là .less
. Trong mọi trường hợp, tôi đã thử kết hợp chuyển đổi .less
cho số .css
trong ngọc bích và ít tệp hơn mà không thành công.
Nếu bạn có thể giúp hoặc có giải pháp, tôi đánh giá cao nó.
Lưu ý: Phần ngọc bích hoạt động tốt nếu tôi nhập bất kỳ ol '.css
nào.
Note2: Ít biên dịch hơn nếu tôi sử dụng lessc thông qua dòng lệnh.
THANKS !! Tôi đã thay đổi trình biên dịch thành "app.use (express.compiler ({src: __dirname + '/ public', cho phép: ['less']}));" Nhưng khi html/jade được trỏ đến một tệp .less, nó không diễn giải nó thành tệp .css. Bất kỳ đề xuất? – Paden
Ahh, làm cho nó hoạt động! Tệp tin ngọc của tôi phải trỏ đến một tệp .css và ít liên kết hơn sẽ được biên dịch! CẢM ƠN ĐÃ GIÚP ĐỠ!! : D – Paden
Một điều nữa, @import không nên có phần mở rộng. Vì vậy: "@import"/public/stylo/goodies ";" – Paden