#session #storage
#сеанс #Хранение
Вопрос:
я хочу получить хранилище сеанса в свой файл scss, здесь есть мой файл scss и файл component.ts
<<---- component.ts file ---->>
this.BarWidth = sessionStorage.getItem('BarWidth');
this.BarHeight = sessionStorage.getItem('BarHeight');
<<--- Scss file --->>
$BarWidth = sessionStorage.getItem("BarWidth");
$BarHeight = sessionStorage.getItem("BarHeight");
.barcode_6_style {
max-width: $BarWidth;
min-width: $BarWidth;
max-height: $BarHeight;
min-height: $BarHeight;
border-style: solid;
border-left-width: 1px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
}`
Ответ №1:
Некоторое время назад я хотел использовать ту же функцию, но понял, что это уже поддерживается webpack. Мое решение выглядит так:
var sass = encodeURIComponent(jsonToSassVars(sassGlobals));
var webpackConfig = {
module: {
loaders:[
{test: /.scss$/, loader: "style!css!sass!prepend?data=" sass}
]
},
}