0

I am currently trying to get gulp to run on my Laravel project.

I can successfully run gulp on my app.scss

I am trying to run gulp on a test coffee script, the coffee script is found in resources > assets > coffee > test.coffee

here is my gulpfile.js

var elixir = require('laravel-elixir');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {
    mix.sass('app.scss');
    mix.coffee();
});

When I run gulp I get this error.

fetching Sass Source Files...
   - resources/assets/sass/app.scss


Saving To...
   - public/css/app.css

[23:08:58] Finished 'default' after 313 ms
[23:08:58] gulp-notify: [Laravel Elixir] Sass Compiled!
[23:08:58] Finished 'sass' after 403 ms
[23:08:58] Starting 'coffee'...
[23:08:58] 'coffee' errored after 311 μs
[23:08:58] TypeError: Cannot call method 'indexOf' of undefined
    at prefixOne (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:104:18)
    at GulpPaths.prefix (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:124:12)
    at GulpPaths.src (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:24:16)
    at prepGulpPaths (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/tasks/coffee.js:55:10)
    at null.definition (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/tasks/coffee.js:21:21)
    at Task.run (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/Task.js:96:17)
    at Gulp.<anonymous> (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/index.js:94:52)
    at module.exports (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/index.js:214:10)
[23:08:58] Error in plugin 'run-sequence'
Message:
    An error occured in task 'coffee'.

Has anyone else experienced this error?

1 Answer 1

2

You did not specifiy the name of the coffee script, so Elixir doesn't know what file it needs to compile. The only thing you need to do is specify the name of the script between the curly brackets like so:

elixir(function(mix) {
  mix.coffee('test.coffee');
});

There is also something called method chaining. This will allow you to run multiple tasks at once. If you add your Sass, your code should look something like this:

elixir(function(mix) {
  mix.sass('app.scss')
     .coffee('test.coffee');
});

You can always check the laravel docs for more information about Elixir here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.