Search code examples
csslaravelcoffeescriptsasslaravel-elixir

Compiling files with laravel + elixir


I am taking over a laravel project that uses elixir to compile various sass, coffeescript, and javascript files:

elixir(function(mix) {
    mix.sass('main.scss')
        .coffee(['methods.coffee', 'details.coffee', 'cars.coffee', 'context-menu.coffee', 'content.coffee', 'projects.coffee', 'main.coffee'])
        .styles(['main.css'], 'public/css/all.css', 'public/css')
        .scripts(['app.js'], 'public/js/all.js', 'public/js')
        .version(['css/all.css', 'js/all.js']);
}); 

My questions:

What is the destination of the files below after they are compiled?

.coffee(['methods.coffee', 'details.coffee', 'cars.coffee', 'context-menu.coffee', 'content.coffee', 'projects.coffee', 'main.coffee'])

Does the line below compile the app.js file as all.js and store it in public/js?

.scripts(['app.js'], 'public/js/all.js', 'public/js')

Similarly, does the line below compile the main.css file as all.css and store it in public/css?

.styles(['main.css'], 'public/css/all.css', 'public/css')

Thanks in advance!


Solution

  • By default, the task will place the compiled in:

    • sass = public/css/app.css
    • coffee = public/js/app.js
    • scripts= public/js/all.js
    • styles = public/css/all.css

    UPDATE

    To change the output path just pass a second argument to the method

    e.g.

    mix.styles([
        'bundle.css'
    ], 'public/css/aloha');