laravel-elixir-css-url-adjuster
v3.0.0
Published
A gulp-css-url-adjuster wrapper ingredient for Laravel Elixir 3.
Downloads
17
Readme
#CSS url adjuster Ingredient for Laravel Elixir 3
This is a simple gulp-css-url-adjuster wrapper ingredient for Laravel Elixir 3.
Installation
Using NPM to install Laravel Elixir css-url-adjuster and save your packages.json
For laravel-elixir 3
npm install --save-dev laravel-elixir-css-url-adjuster
For Laravel-Elixir 2
npm install --save-dev laravel-exlixir-css-url-adjuster@"^2.0"
Usage
This package allows gulp to change css urls
css file:
.cool-background {
background-image: url('coolImage.jpg');
}
gulp file:
require('laravel-elixir-css-url-adjuster');
mix.urlAdjuster('style.css', {
prepend: '/image_directory/',
append: '?version=1'
}, 'modifiedStyle.css');
after modified:
.cool-background {
background-image: url('/image_directory/coolImage.jpg?version=1');
}
only adjust relative paths:
.cool-background {
background-image: url('coolImage.jpg');
}
.neato-background {
background-image: url('/images/neatoImage.jpg');
}
mix.urlAdjuster('style.css', {
prependRelative: '/image_directory/'
}, 'modifiedStyle.css');
.cool-background {
background-image: url('/image_directory/coolImage.jpg');
}
.neato-background {
background-image: url('/images/neatoImage.jpg');
}
or replace path to another:
.cool-background {
background-image: url('/old/path/coolImage.jpg');
}
.neato-background {
background-image: url('/old/path/images/neatoImage.jpg');
}
mix.urlAdjuster('style.css', {
replace: ['/old/path', '/brand/new']
}, 'modifiedStyle.css');
.cool-background {
background-image: url('/brand/new/coolImage.jpg');
}
.neato-background {
background-image: url('/brand/new/images/neatoImage.jpg');
}
Bugs and Contributions
If you find a bug, please post an issue on GitHub describing the problem. Or better yet, make a pull request with the solution.
License
This is open-sourced software licensed under the MIT license