Php 拉维长生不老药包括不起作用的路径

Php 拉维长生不老药包括不起作用的路径,php,laravel,bootstrap-sass,laravel-elixir,Php,Laravel,Bootstrap Sass,Laravel Elixir,我正在尝试Laravel Elixir,并希望在includePaths中包含引导,但它不起作用。我哪里做错了 var paths = { 'bootstrap': './vendor/bower_components/bootstrap-sass-official/assets/' } elixir(function(mix) { mix.sass("style.scss", 'public/assets/css/', {includePaths: [paths.bootst

我正在尝试Laravel Elixir,并希望在includePaths中包含引导,但它不起作用。我哪里做错了

var paths = {
    'bootstrap': './vendor/bower_components/bootstrap-sass-official/assets/'
}

elixir(function(mix) {
    mix.sass("style.scss", 'public/assets/css/', {includePaths: [paths.bootstrap + 'stylesheets/']})
});

我不确定你是否有理由想在你的gulpfile中使用includePaths,但对于bootstrap,你不必这么做。引导包含路径已在/node_modules/laravel elixir/Components中现成配置:

elixir.extend('sass', function(src, output, options) {

    options = _.extend({
        outputStyle: inProduction ? 'compressed' : 'nested',
        includePaths: [elixir.config.bowerDir + "/bootstrap-sass-official/assets/stylesheets"]
    }, options);

    return compile({
        compiler: 'Sass',
        pluginName: 'sass',
        pluginOptions: options,
        src: src,
        output: output,
        search: '**/*.+(sass|scss)'
    });
});
所以你要做的就是,在你的肚子里:

elixir(function(mix) {
    mix.sass("style.scss");
});
然后在您的style.scss中:

@import "bootstrap";
我认为您必须将.bowerrc文件设置为:

{
  "directory": "vendor/bower_components"
}

但看起来您已经这样做了。

另一种解决方案是使用此行编译位于供应商文件夹中的sass或更少的文件:

mix.less("../../../vendor/twbs/bootstrap/less/bootstrap.less");
注意:我使用了“composer require twbs/boostrap”来获得完整的包。不需要凉亭

编辑:

我将编译后的css文件输出到资源文件夹,以将其与其他css文件合并:

mix.less("../../../vendor/twbs/bootstrap/less/bootstrap.less", 'resources/css');


mix.styles([
    "bootstrap.css"
], 'public/css/app.css');

我知道这已经有了一个公认的答案,但我得到了这样的工作

var paths = {
    'bootstrap': '/bower_components/bootstrap-sass/assets/',
}

elixir(function (mix) {
    mix.sass('app.scss', 'public/css', {
        includePaths: [
            __dirname + paths.bootstrap + 'stylesheets/'
        ]
    });

    mix.version("css/app.css");
});
其中,
bower\u组件
安装在laravel根目录中


(From:)

您的答案实际上是另一个问题,./vender/bower_组件中的包可能是其他任何东西,但此问题仍然没有答案。我在包括备用INCLUDEPATH和识别它们时遇到了麻烦。