laravel-elixir-config
v1.1.2
Published
Overrides laravel elixir config from elixir.json
Downloads
54
Maintainers
Readme
laravel-elixir-config
Overrides laravel-elixir configuration from
elixir.json
orelixir.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
oryaml
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
- yamljs - Standalone JavaScript YAML 1.2 Parser & Encoder.
- laravel-blade-jade - Create laravel blade views using jade
Official Documentations
- Documentation for Elixir can be found on the Laravel website.
- Laravel elixir source code.
License
MIT @ Guntur Poetra