Skip to content
A Laravel Mix extension for Webpack alias support.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.npmignore Add laravel mix alias extention Apr 27, 2019
README.md
index.js Add laravel mix alias extention Apr 27, 2019
package.json 1.0.1 May 2, 2019

README.md

Laravel Mix Alias

Add aliases to your source files.

Installation

npm install laravel-mix-alias --save

or

yarn add laravel-mix-alias

Usage

Your webpack.mix.js could look like this:

const mix = require('laravel-mix');
require('laravel-mix-alias');

mix.alias({
    '@': '/resources/js',
    '~': '/resources/sass',
});

or add them one by one

const mix = require('laravel-mix');
require('laravel-mix-alias');

mix.alias('@', '/resources/js');
mix.alias('~', '/resources/sass');

Now you can import sass files from the path you specified

@import "~/variables";

Or import scripts from the path you specified

import '@/script.js';

Author

Maxim Vanhove Web developer at Starring Jane

Twitter Follow

You can’t perform that action at this time.