美文网首页
js共享scss中的变量

js共享scss中的变量

作者: 苗喵秒 | 来源:发表于2020-03-06 09:13 被阅读0次

参考链接
https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
使用方法

// styles/animation.scss
$animation-length: 250;
$animation-length-ms: $animation-length + 0ms;

:export {
  animationMillis: $animation-length-ms;
}

// test.js
import styles from '../styles/animation.scss'
const millis = parseInt(styles.animationMillis)

相关文章

网友评论

      本文标题:js共享scss中的变量

      本文链接:https://www.haomeiwen.com/subject/ikqvrhtx.html