Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

This is a simple gulp-css-url-adjuster wrapper ingredient for Laravel Elixir.

License

Notifications You must be signed in to change notification settings

farrrr/laravel-elixir-css-url-adjuster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

This is a simple gulp-css-url-adjuster wrapper ingredient for Laravel Elixir.

Resources

License

Stars

Watchers

Forks

Packages

No packages published