我遇到了一個我沒有看到的奇怪問題。我試圖做一些基本的除了一些像這樣的變量:LESS加法運算符(+)正在追加而不是添加
@screen-break-sm: 768px;
@screen-break-md: 992px;
@screen-max-mobile: @screen-break-sm;
@screen-min-desktop: @screen-break-sm + 1;
然後,這些值被一些媒體查詢使用。當使用gulp-less
編譯(版本〜中的package.json 3.0.0)通過咕嘟咕嘟,輸出最終被類似:
@media (min-width:768px + 1) {
// CSS
}
我期待:
@media (min-width:769px) {
// CSS
}
我曾嘗試作爲@screen-break-sm + 1
和screen-break-sm + 1px
的加法。我也嘗試刪除原始值的px
部分,然後添加並追加px
,但這並不會增加。
如果它是相關的,這是建立一個部分,在那裏我第一次遇到了這個問題吞氣腳本之一:
module.exports = function (build) {
return function() {
var pagesPath = build.options.styles.buildPath + '/pages/';
return build.gulp.src('./resources/assets/less/pages/**/*')
.pipe(build.plugins.less({
paths: [ build.plugins.path.join(__dirname, 'less', 'vendor', 'theme', 'bootstrap') ]
})).on('error', build.errorHandler)
.pipe(build.plugins.minifyCss()).on('error', build.errorHandler)
.pipe(build.plugins.extReplace('.min.css')).on('error', build.errorHandler)
.pipe(build.gulp.dest(pagesPath));
};
};
任何想法,爲什麼少即是串聯/而不是追加執行另外的?
[編輯]
雖然該解決方案是一樣被認定爲可能重複的另一個問題,這個問題不討論,用戶將直接遇到的問題,所以我覺得這個問題是非常更適合搜索目的。在Google搜索一小時之後,我一直沒有找到解決方案,只有在得到答案之後,「嚴格的數學」措辭才能顯示出其他問題。
的[使用較少的遞歸函數生成的風格和媒體查詢]可能的複製(http://stackoverflow.com/questions/24241544/generate-styles-using-less-recursive-function-and-media-queries ) –