Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including laravel-elixir-config with all npm packages installed. Try it out:

var laravelElixirConfig = require("laravel-elixir-config")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

laravel-elixir-config v1.1.2

Overrides laravel elixir config from elixir.json

laravel-elixir-config Build Status npm

Overrides laravel-elixir configuration from elixir.json or elixir.yml.

Why?

Since laravel-elixir version ^6.0.x, overrides the configuration from elixir.json has been removed. See #648.

  • Set the config in your Gulpfile instead.
  • Write the config with json or yaml format, everything you like.
  • Assign an object

Install

npm install --save-dev laravel-elixir-config

Usage

Update the gulpfile.js.

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

// ...
require('laravel-elixir-config');

Create elixir.json or elixir.yml file in the project root directory.

Examples

  • elixir.json
{
    "assetsPath": "assets",
    "css": {
        "outputFolder": "assets/css",
        "sass": {
            "pluginOptions": {
                "includePaths": [
                    "node_modules",
                    "bower_components"
                ]
            }
        }
    },
    "js": {
        "outputFolder": "assets/js"
    }
}
  • elixir.yml
assetsPath: assets
css:
    outputFolder: assets/css
    sass:
        pluginOptions:
            includePaths:
                - node_modules
                - bower_components
js:
    outputFolder: assets/js

API

If you want something different or separate your config file, you can use this API.

elixir.configFile(path)

This will be replace the elixir.(json|yml) if it exists from your custom path.

path

  • Type: string
  • Extension: .json, .yml, .yaml

Example

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

// ...
require('laravel-elixir-config');

elixir.configFile('./customFile.json');

Tips

😄 Make happy the gulpfile.js.

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

require('laravel-elixir-config');

elixir((mix) => {
    // copy fonts
    mix.copy(elixir.config.fonts.sourceFolder, elixir.config.fonts.outputFolder);

    // copy images
    mix.copy(elixir.config.images.sourceFolder, elixir.config.images.outputFolder);
});
  • elixir.yml
fonts:
    sourceFolder:
        - node_modules/bootstrap-sass/assets/fonts/bootstrap
        - node_modules/font-awesome/fonts
    outputFolder: public/assets/fonts
images:
    sourceFolder: resources/assets/img
    outputFolder: public/assets/img

YAML

Indent style must be space. See the spec YAML version 1.2

Related

Official Documentations

License

MIT @ Guntur Poetra

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free