简体   繁体   English

使用webpack / laravel混合的自定义引导程序?

[英]Custom version of bootstrap using webpack/laravel mix?

I'm trying to create a custom build of bootstrap 4 using webpack, but it won't compile. 我正在尝试使用webpack创建Bootstrap 4的自定义版本,但无法编译。

I have bootstrap 4 here: 我在这里有引导程序4:

/node_modules/bootstrap/scss

I create my own app.scss file to import the various parts of bootstrap that I want: 我创建了自己的app.scss文件,以导入所需的引导程序的各个部分:

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

In my webpack file I have: 在我的webpack文件中,我有:

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

I've also tried: 我也尝试过:

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

You can import bootstrap in app.scss with: 您可以使用以下命令在app.scss中导入引导程序:

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

The ~bootstrap is resloved to the npm package. ~bootstrap被resloved到故宫包。 This way you won't have to configure the mix file. 这样,您就不必配置混合文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM