这里的初学者..。我有一个简单的Vue (2)应用程序,并安装了节点sass和sass加载程序。遵循这里的指令。
Buefy是在main.js中导入的,下面是我的App.vue(下半部分):
<style lang="scss">
// Import Bulma's core
@import "~bulma/sass/utilities/_all";
// Set your colors
$primary: #8c67ef;
$primary-light: findLightColor($primary);
$primary-dark: findDarkColor($primary);
$primary-invert: findColorInvert($primary);
$twitter: #4099FF;
$twitter-invert: findColorInvert($twitter);
// Lists and maps
$custom-colors: null !default;
$custom-shades: null !default;
// Setup $colors to use as bulma classes (e.g. 'is-twitter')
$colors: mergeColorMaps(
(
"white": (
$white,
$black,
),
"black": (
$black,
$white,
),
"light": (
$light,
$light-invert,
),
"dark": (
$dark,
$dark-invert,
),
"primary": (
$primary,
$primary-invert,
$primary-light,
$primary-dark,
),
"link": (
$link,
$link-invert,
$link-light,
$link-dark,
),
"info": (
$info,
$info-invert,
$info-light,
$info-dark,
),
"success": (
$success,
$success-invert,
$success-light,
$success-dark,
),
"warning": (
$warning,
$warning-invert,
$warning-light,
$warning-dark,
),
"danger": (
$danger,
$danger-invert,
$danger-light,
$danger-dark,
),
),
$custom-colors
);
// Links
$link: $primary;
$link-invert: $primary-invert;
$link-focus-border: $primary;
// Import Bulma and Buefy styles
@import "~bulma";
@import "~buefy/src/scss/buefy";
</style>因此,我运行npm运行服务-我的应用程序工作良好-但只有默认的Bulma风格。也就是说-如果我加上:
<style lang="css">
.somestyle {
color: red;
}
</style>..。然后点击“保存”-应用程序加载正确的样式。但如果我点击刷新浏览器-自定义样式消失,我回到原来的Bulma样式。基本上,我无法让自定义的scss“坚持”。
我已经让这个工作在一个不同的应用程序(据我所能看到)完全相同的设置!这个问题使我心烦意乱:
"vue": "^2.6.12",
"buefy": "^0.9.4",
"bulma": "^0.9.3",
"node-sass": "^5.0.0",
"sass-loader": "^10.1.0" 不知道这里还包括什么-但任何想法都会非常感谢!
发布于 2021-07-21 08:08:48
我认为问题可能在于,事实上,你并没有把你的变量联系起来。
https://vue-loader.vuejs.org/guide/pre-processors.html#sharing-global-variables
下面是我如何将Bulma连接到Vue项目,我认为您可以在连接Buefy时使用相同的模式
// main.ts
import '@/assets/scss/main.scss'// main.scss file
@import "~bulma";
@import "./_variables.scss"; // _variables.scss file
...all my sass-variables...
@import "~bulma/sass/utilities/_all";// vue.config.js
module.exports = {
css: {
loaderOptions: {
scss: {
prependData: '@import "~@/assets/scss/_variables.scss";'
}
}
}
}https://stackoverflow.com/questions/68460446
复制相似问题