Fluent API for Gulp.

Related tags

Task Runners elixir
Overview

Laravel Elixir

Please note that this project has been archived. Instead, we recommend that you transition to Laravel Mix.

Introduction

Laravel Elixir provides a clean, fluent API for defining basic Gulp tasks for your Laravel application. Elixir supports several common CSS and JavaScript pre-processors, and even testing tools.

If you've ever been confused about how to get started with Gulp and asset compilation, you will love Laravel Elixir!

Official Documentation

Documentation for Elixir can be found on the Laravel website.

License

Laravel Elixir is open-sourced software licensed under the MIT license.

Comments
  • Added bower support

    Added bower support

    Added a task which will take js or css files from the bower components directory and add them into the public directory.

    One think worth noting is I have to require the packge 'main-bower-files' in the JS as I can't use 'gulp-load-plugins' See this issue for more details

    https://github.com/ck86/main-bower-files/issues/29

    opened by joshhornby 18
  • Automatic Autoprefixer feature on Custom Styles

    Automatic Autoprefixer feature on Custom Styles

    I know this isn't the most elegant solution for the (custom styles) autoprefixer case, but for me it works great! If you guys have a nicer solution, please teach me so I can do better! I know too that this is not the right place to put a autoprefixer service. (because this is a combiner task file). But it works so beautiful, sorry that the code looks inconsistent and so ugly.

    opened by jonathanpmartins 15
  • Added config.publicDir, removed hardcode in version.js

    Added config.publicDir, removed hardcode in version.js

    Removed hardcoded path to ‘public’ folder as it is not always named this way. We can change our cssOutput or jsOutput but it breaks version.js because of predefined base path in the task.

    opened by edpelesh 12
  • configurable

    configurable "runAllTasks()" before watch

    It was added a configuration to enable/disable runAllTasks() call before watch.

    This should help in some cases when gulp watch fails because of watchers start before all tasks are finished.

    It is like a hack, but it can be useful. I think that to fix all the issues related to watch

    opened by StefanoMagrassi 10
  • Copy assets files when using mix.version() command

    Copy assets files when using mix.version() command

    It's somewhat common to use relative paths in .css files.

    Versioning such files with elixir invalidates all relative paths: http://stackoverflow.com/questions/27789466/asset-management-maintaining-reference-to-relative-assets-after-concatenation/32223524#32223524

    This PR proposes a simple syntax to solve this kind of problem, by allowing users to define an array of paths relative to /public as a second (or third) argument, so they'll be copied to /build after version command executes.

    Usage

    mix.version(
        ['css/style.css', 'css/vendor/style.css'], //files to be versioned
        'public/build', //build dir
        ['fonts', 'css/vendor/icons'] //dependent files/dirs to be copied
    );
    

    This will also re-copy every dependent files when using gulp watch.

    on hold 
    opened by rafaelbeckel 9
  • version method should wait while deleting.

    version method should wait while deleting.

    The version() method empties and re-creates the build folder. All right. But if you attach any task after version() related with the "build" folder (or its children), it will throw you an error because the "build" folder doesn't exist yet (it's deleting).

    One example : In my case, I want to create symlinks in the "public/build" folder. I've made my own Elixir extends named symlinks(). I have something like :

    mix.
    // some tasks...
    .version([
           'public/assets/styles.css',
            'public/assets/scripts.js'
    ]).symlinks([
            {src: 'app/assets/fonts', dest:'public/build/assets/fonts'},
            {src: 'app/assets/img', dest:'public/build/assets/img'}
    ]);
    

    I had errors (ENOENT) because it couldn't create the symlink : "public/build/..." didn't exist yet. This solution make it works fine.

    opened by damienfa 9
  • Added ability to configure watch

    Added ability to configure watch

    Allow gulp watch to be configured. This addressed the problem in #586 for me on a Linux system as I was able to disable polling.

    The defaults are the same as they were prior to this commit: polling at a 1s interval.

    Thanks!

    opened by jeffturcotte 8
  • Gulp PhpUnit Fix for Windows

    Gulp PhpUnit Fix for Windows

    Wrapped the path used to call phpunit from gulp with path.normalize. This makes gulp able to run phpUnit from Windows. Haven't tested to ensure this didn't break anything for mac or linux, but hopefully it should be pretty safe.

    opened by pataelmo 8
  • Allow an actual buildDir to be set and only delete versioned files

    Allow an actual buildDir to be set and only delete versioned files

    This is in response to #66

    This is my first nodejs change so I'm expecting it to need updating, it also removes some previous 'features' in the default instance.

    Whatever is passed as the second parameter to version is now used, as-is, for the build path (no /build is appended). This allows the files to be created wherever someone might want them.

    Only files that are defined within the rev-manifest.json file are deleted now. Since it's possible to put the files in any folder we can't just delete everything because things will go missing (as I learnt while developing this). This does mean that if you're using the default setup that empty folders won't get deleted, but it's highly likely they would just've been re-created anyway.

    The duplicated app.css files that would be created by the versioning aren't cleaned up after the versioning. They aren't deleted at the start when deleting the pervious versioned files since it's possible that we wouldn't be deleting the duplicated file but the original.

    Map files are only copied if the new location doesn't match the old location.

    on hold 
    opened by EspadaV8 8
  • Added ability to change public directory

    Added ability to change public directory

    If you didn't use public as public directory, version would fail, no matter what because it was hard coded. This change will allow you to change it.

    If you are using public_html instead of public, you can with this change use

    .version('css/app.css', 'public_html', 'public_html');
    

    This will set the base path to public_html (third argument). Second argument would tell the build directory to be public_html/build.

    opened by Marwelln 8
  • fixed less, sass watching

    fixed less, sass watching

    If you try to import other files in app.scss they are not watched

    app.scss

    @import "_module";
    

    _module.scss

    body {
        color: #000;
    }
    

    gulpfile.js

    var elixir = require('laravel-elixir');
    
    elixir(function(mix) {
        mix.sass('app.scss');
    });
    

    _module.scss is not watched

    opened by ricardogobbosouza 7
Releases(4.0)
  • 4.0(Nov 20, 2015)

    • Vueify removed (in favor of Elixir extension)
    • gulp-babel bumped to v6.1
    • Babel upgraded to v6

    Breaking Changes

    Babel

    The main reason for the 4.0 bump is to account for Babel 6.

    http://babeljs.io/blog/2015/10/29/6.0.0/

    Babel no longer includes plugins out of the box, so we've updated Elixir's Babel config to reflect the new system. By default, we're pulling in the ES2015 preset, which should include everything you need when running mix.babel() or mix.browserify().

    If your Gulpfile was tweaking Elixir's Babel config, make sure you adjust accordingly. See here, where we swap to using a preset.

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

    Vueify Removed

    Vueify support has been removed entirely, in order to limit Elixir's dependency list a bit. Don't worry; it's easy to return.

    First, install the Laravel Elixir Vueify extension:

    npm install laravel-elixir-vueify
    

    Next, require it in your main Gulpfile, at the top, like this:

    var elixir = require('laravel-elixir');
    
    require('laravel-elixir-vueify');
    
    elixir(function(mix) {
        mix.browserify('main.js');
    });
    

    And that's it! Call mix.browserify() like you've always done.

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jul 25, 2015)

    Installation

    In your project's root package.json file, update the Laravel Elixir version number to ^3.0.0, and run npm update.

    {
      "dependencies": {
        "laravel-elixir": "^3.0.0"
      }
    }
    

    New

    • True sequential tasks. With Laravel Elixir 2.0...

      mix.sass('one.scss').coffee('module.coffee').sass('two.scss');
      

      would trigger both of your Sass calls, before moving on to the CoffeeScript task. In some situations, this can create issues - where, for example, the second Sass call depends upon some file being created before it.

      With Elixir 3, we now have truly sequential tasks. Trigger, Sass, then Coffee, then Sass.

    • More explicit logging. The Terminal will now detail the exact source and output files/directories that the current task is referencing (based upon your Gulpfile). http://d.pr/i/T8q3

    • Easier configuration. Review the new config.js file. Note that any of these values may be updated by you. Of course, with Laravel, it's recommended that you stick to the defaults, but when you require, for example, a unique path to your assets or public directory, you may update these values, as needed.

      You may do so either in your main Gulpfile:

      elixir.config.publicPath = './public_html';
      

      Or, if you need to update multiple pieces of configuration, create an elixir.json file in your project, and insert a JSON object that should override any of the properties that have been set in config.js. For instance:

      {
          "publicPath": "./public_html",
      
          "css": {
              "outputFolder": "stylesheets"
          }
      }
      

    Anything you add here will override the defaults. Also, note that you can modify plugin options or even your desired Browserify transformations from this file.

    • Better File Validation. Ever fall into the trap of thinking you're compiling one file, only to realize that Elixir was trying to reference a different path? Maybe even a file that doesn't exist in your app? With Elixir 3.0, you'll now be alerted when a given source file does not exist. http://d.pr/i/15Hel

    • Simpler Extensions. Creating an Elixir extension is now as simple as:

      Elixir.extend('speak', function(message) {
      
          new Task('speak', function() {
              return gulp.src('').pipe(shell('say ' + message));
          })
          .watch('./app/**');
      
      });
      
      // mix.speak('Hello World');
      

    Fixes

    • If you call an Elixir task, and provide a single file name as the source path, Elixir will use that file name as the output file name. In older versions, assuming you didn't provide an explicit output file path, Elixir would use a generic name, such as app.css. Now, as noted, it'll grab the source file name instead.

      mix.sass('foo.scss'); // compiles to ./public/css/foo.css
      

    Breaking Changes

    The main API for Elixir - the one you'll reference in your Gulpfile - is identical to past versions. However, both config paths and extension creation have changed.

    • mix.version(path) no longer automatically adds the public path as the base directory. For instance, before, mix.version('css/foo.css') would look within "public/css/foo.css". Now, it'll look for "css/foo.css". Manually add "./public". (This way, any file may be versioned.)
    • Refer to config.js to find the new configuration file. If you were modifying these values in your project, when you update Elixir to 3.0, ensure that you now reference the new path to the property setting.
    • Any Laravel Elixir extensions will need to be updated to support version 3.0. Don't worry, it's quick to do so, and removes a lot of boilerplate.

    Using that speak extension example from above, in Elixir 2.0, you would create it, like so:

        var gulp = require('gulp');
        var shell = require('gulp-shell');
        var Elixir = require('laravel-elixir');
    
        Elixir.extend('speak', function(message) {
    
            gulp.task('speak', function() {
                return gulp.src('').pipe(shell('say ' + message));
            });
    
            return this.queueTask('speak')
                       .registerWatcher('speak', './app/**');
    
        });
    
        // mix.speak('Hello World');
    

    With version 3.0, you'd do:

        var gulp = require('gulp');
        var shell = require('gulp-shell');
        var Elixir = require('laravel-elixir');
    
        var Task = Elixir.Task;
    
        Elixir.extend('speak', function(message) {
    
            new Task('speak', function() {
                return gulp.src('').pipe(shell('say ' + message));
            })
            .watch('./app/**');
    
        });
    
        // mix.speak('Hello World');
    

    Notice that you no longer need to personally call Gulp.task(). Elixir will handle that dynamically. Your only job is to create a new Elixir Task, and give it both a name and a definition. That definition should be a callback function that triggers Gulp, however is appropriate for your task. This is where you'll add your gulp.src('...') bits.

    Always return the stream from this callback function. This is necessary to have truly sequential task calls.

    Should you need to watch files for changes, and then subsequently trigger your task again, you may use the watch method on the Task object, as demonstrated above. Simply provide a regular expression, and Elixir will keep an eye on any of those files for changes.

    Source code(tar.gz)
    Source code(zip)
Owner
The Laravel Framework
The Laravel Framework
Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs) in PHP using a fluent API.

Crunz Install a cron job once and for all, manage the rest from the code. Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs)

Reza Lavarian 1.4k Dec 26, 2022
Laravel 5 with Dockerized Gulp, PHP-FPM, MySQL and nginx using docker-compose

docker-laravel Laravel 5 with Dockerized PHP-FPM, MySQL and nginx using docker-compose Usage Get Composer docker-compose run --rm phpnginx curl -O htt

Harsh Vakharia 83 Feb 8, 2022
Laravel + Angularjs + Bootstrap + AdminLTE binded by Gulp workflow Admin Dashboard Boilerplate / Starter.

Laravel Angular Admin Laravel + Angularjs + Bootstrap + AdminLTE binded by Gulp workflow Admin Dashboard Boilerplate. Plus Oauth and JWT authenticatio

Alex Quiambao 927 Dec 30, 2022
Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks

RoboTask Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks: writing cross-platform scripts processing assets

Consolidation 2.6k Jan 3, 2023
Set of front-end tools for Magento 2 based on Gulp.js

Magento 2 Frontools Set of front-end tools for Magento 2 Requirements Unix-like OS (please, do not ask about Windows support) Node.js LTS version. We

SNOW.DOG 433 Dec 6, 2022
Build and execute an Elasticsearch search query using a fluent PHP API

PACKAGE IN DEVELOPMENT, DO NOT USE YET Build and execute ElasticSearch queries using a fluent PHP API This package is a lightweight query builder for

Spatie 94 Dec 14, 2022
Create executable strings using a fluent API.

command-builder A PHP class to build executable with using fluent API. Summary About Features Installation Examples Compatibility table Tests About I

Khalyomede 2 Jan 26, 2022
Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs) in PHP using a fluent API.

Crunz Install a cron job once and for all, manage the rest from the code. Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs)

Reza Lavarian 1.4k Dec 26, 2022
Object-oriented, composable, fluent API for writing validations in Laravel

Laravel Hyrule Hyrule provides an object-oriented, fluent API for building validation rules for use w/ Laravel's Validation component. This unlocks pa

Square 330 Dec 8, 2022
This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube features.

Laravel Youtube Client This package provides a simple and intuitive way to work on the Youtube Data API. It provides fluent interface to Youtube featu

Tilson Mateus 6 May 31, 2023
A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

Idiorm http://j4mie.github.com/idiormandparis/ Feature/API complete Idiorm is now considered to be feature complete as of version 1.5.0. Whilst it wil

Jamie Matthews 2k Dec 27, 2022
A fluent extension to PHPs DateTime class.

Expressive Date A fluent extension to PHPs DateTime class. Table of Contents Installation Composer Manually Laravel 4 Usage Getting Instances Quick He

Jason Lewis 258 Oct 9, 2021
Fluent regular expressions in PHP

FLUX (Fluent Regex) 0.5.2 by Selvin Ortiz Description Fluent Regular Expressions in PHP inspired by and largely based on VerbalExpressions:JS by Jesse

Selvin Ortiz 341 Nov 20, 2022
Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a fluent syntax for mapping, querying, and storing eloquent models.

Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a f

Sleiman Sleiman 511 Dec 31, 2022
Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

Introduction Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services. It handles almost all of the boilerpl

The Laravel Framework 2.2k Dec 31, 2022
ATOMASTIC 14 Mar 12, 2022
Enable method chaining or fluent expressions for any value and method.

PHP Pipe Operator A (hopefully) temporary solution to implement the pipe operator in PHP. Table of contents Requirements How to install How to use The

Sebastiaan Luca 268 Dec 26, 2022
Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

Introduction Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services. It handles almost all of the boilerpl

The Laravel Framework 2.2k Jan 4, 2023
Laravel Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

Introduction Laravel Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services. It handles almost all of the b

The Laravel Framework 189 Jan 5, 2023
Querycase provides a convenient, fluent interface for creating and running database queries in WordPress.

Querycase database for WordPress Dependency-free library to create SQL Queries in WordPress. Explore the documentation → ℹ️ About Querycase Querycase

Alessandro Tesoro 7 Oct 17, 2021