關(guān)于scss的寫法以及setting公共變量的提取

Settings層代碼實(shí)現(xiàn)

SASS的介紹

定義一些公共變量

公共變量:顏色、邊框、字體大小、陰影、層級(jí)..


變量的寫法

$col:#666;

.text1?{

color:?$col;

}

.text2?{

color:?$col;

}

.text3?{

color:$col;}


//嵌套寫法

main?{

color:#00ff00;

.redbox?{

background-color:?#ff0000;}

}

#main?{

color:?#00ff00;}

#main?.redbox{

background-color:#ff0000;

}


//?mixin混合寫法

@mixin?large-text{color:#fff;}

.page-title?{

@include?large-text;

padding:?4px;

}

.page-title?{

color:#fff;padding:?4px;}


//function的寫法

@function?grid-width($n){

??@return?$n?*?100px;

??}

#sidebar?{

???width:?grid-width(2);

}

#sidebar?{

width:200px;

}

setting層的公共變量的提取 按照出現(xiàn)次數(shù)最多方法進(jìn)行一個(gè)培訓(xùn)

次數(shù)最多的排第一位

然后再通過(guò)index.scss 進(jìn)行一個(gè)導(dǎo)入導(dǎo)出的曝光


然后在vue.config

然后新建vue.config.js

//?vue.config.js

//?vue.config.js

module.exports?=?{

????css:?{

??????loaderOptions:?{

????????scss:?{

????????????prependData:?`

????????????@import?"@/style/settings/var.scss"

????????????@import?"@/style/tools/_sassMagic.scss";`

????????},

??????}

????}

??}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容