wtt-sass

1. 引入

Usage no npm install needed!

<script type="module">
  import wttSass from 'https://cdn.skypack.dev/wtt-sass';
</script>

README

wtt-sass

配置(当前是基于 vue-cli3 引入),vue.config.js

  1. 引入
let includePaths = require('wtt-sass').includePaths; // includePaths是wtt-sass中声明的文件的绝对路径

// 拼接上 @import
includePaths = includePaths.map((v, k) => {
  return `@import "${v}";`
})
  1. 配置 sass-loader
// sass-loader 插件的 option 中增加如下字段:
sass:{
  data: `${includePaths.join('')}`
}