Search code examples
phplaravelgulplaravel-elixir

laravel gulpfile elixr .publish()


i am following the laracasts tutorial,

Over there they had no error during tutorial, But when i am trying to run gulp command i get error

c:\xampp\htdocs\projects\ims>gulp
c:\xampp\htdocs\projects\ims\gulpfile.js:16
        .publish(
         ^
TypeError: undefined is not a function
    at c:\xampp\htdocs\projects\ims\gulpfile.js:16:10
    at Elixir (c:\xampp\htdocs\projects\ims\node_modules\laravel-elixir\index.js:3:5)
    at Object.<anonymous> (c:\xampp\htdocs\projects\ims\gulpfile.js:14:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Liftoff.handleArguments (C:\Users\sizzling\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)

Here is my gulp file

elixir(function(mix) {
    mix.less('app.less')
        .publish(
        'jquery/dist/jquery.min.js',
        'public/js/vendor/jquery.js'
    )
        .publish(
        'bootstrap/dist/js/bootstrap.min.js',
        'public/js/vendor/bootstrap.js'
    )
        .publish(
        'font-awesome/css/font-awesome.min.css',
        'public/css/vendor/font-awesome.css'
    )
        .publish(
        'font-awesome/fonts',
        'public/css/fonts'
    );
});

i know i must have done someway wrong but can't find out where did i go wrong? Any Help would be appreciated.


Solution

  • The .publish() function was an alias to .copy() with the bower path already set, however its since been removed so you need to use .copy(). Something such as this should work

    .copy(
        mix.bowerDir + '/path/to/lib/lib.js',
        'public/js/lib.js'
    );
    

    https://github.com/laravel/elixir/commit/b6d59b9f68978224064964a75a7639f95aa2eeee