【问题标题】:Custom version of bootstrap using webpack/laravel mix?使用 webpack/laravel 组合的自定义引导程序版本?
【发布时间】:2023-03-17 12:14:02
【问题描述】:

我正在尝试使用 webpack 创建 bootstrap 4 的自定义构建,但它不会编译。

我这里有引导程序 4:

/node_modules/bootstrap/scss

我创建了自己的 app.scss 文件来导入我想要的引导程序的各个部分:

@import "variables";
@import "mixins";
@import "custom";
....

在我的 webpack 文件中,我有:

mix.sass('resources/assets/sass/app.scss', 'public/css', null, { includePaths: ['node_modules/bootstrap/scss/'] });

我也试过了:

mix.sass('resources/assets/sass/app.scss', 'public/css', { includePaths: ['node_modules/bootstrap/scss/'] });

【问题讨论】:

    标签: laravel webpack bootstrap-4 laravel-mix


    【解决方案1】:

    您可以使用以下命令在 app.scss 中导入引导程序:

    ..
    @import "~bootstrap/scss/variables"
    @import "~bootstrap/scss/mixins"
    ..
    

    ~bootstrap 被重新添加到 npm 包中。这样您就不必配置混合文件了。

    【讨论】:

    • 谢谢,~ 到底是什么意思,查看节点模块文件夹?
    • 是的,这是webpack的loader提供的一个功能。
    猜你喜欢
    • 2016-10-05
    • 2017-09-20
    • 2023-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-24
    • 2016-03-25
    相关资源
    最近更新 更多