【问题标题】:Laravel Elixr copy method not workingLaravel Elixr 复制方法不起作用
【发布时间】:2015-04-27 12:52:56
【问题描述】:

我正在尝试使用 elixr 从我的 vendor/bower_components 文件夹中复制一些 js 文件,但是在运行 gulp 时它们不会复制。

elixir(function(mix) { mix.less('app.less')
  .copy('underscore/underscore.js', 'public/js/vendor/underscore.js'); });

gulp 没有给出错误。

[14:12:58] Using gulpfile ~/Public/balloonprinting_l5/gulpfile.js
[14:12:58] Starting 'default'... 
[14:12:58] Starting 'less'... 
[14:12:58] Running Less: resources/assets/less/app.less 
[14:12:59] Finished 'default' after 506 ms 
[14:13:00] gulp-notify: [Laravel Elixir] Less Compiled! 
[14:13:00] Finished 'less' after 1.74 s 
[14:13:00] Starting 'copy'... 
[14:13:00] Finished 'copy' after 2.86 ms

【问题讨论】:

    标签: php laravel laravel-5 laravel-elixir


    【解决方案1】:

    您需要指定完整的源路径:

    elixir(function(mix) { mix.less('app.less')
      .copy(
        'bower_components/underscore/underscore.js', 
        'public/js/vendor/underscore.js'
      ); 
    });
    

    如您所见,我在源路径中添加了bower_components/,这是默认的 Bower 包文件夹。

    【讨论】:

    • 感谢您的回复。不,那仍然没有用。此外,根据文档,您不需要设置它。根据 node_modules/laravel-elixir/Config.js 文件,它应该默认为: bowerDir: 'vendor/bower_components',
    • 是的,它是vendor/bower_components,默认的凉亭路径是bower_components,没有vendor/
    • 我刚刚设置了完整路径 'vendor/bower_components/underscore/underscore.js' 并且它有效。不过,除非我误解了文档,否则这不应该是必需的。
    • documentation中只有完整路径的例子
    • 是的,我已经使用 .bowerc 文件将默认 Bower 路径更改为 vendor/bower_components。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-28
    • 2016-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多