Laravel-mix: [Feature request] Custom path for CSS URL processing

Created on 7 May 2017  路  6Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.11.4
  • Node Version (node -v): 7.9.0
  • NPM Version (npm -v): 4.2.0
  • OS: Windows 10 Pro (Version: 1703)

Description:

If we have relative paths in our CSS (and processCssUrls is true), then after the processing, these files are moved to /public/images or /public/fonts. Some people may not like that the files are moved to the root directory and want to move the files to the /public/assets/images, for example.

This path is hardcoded in setup/webpack.config.js:

if (! /node_modules|bower_components/.test(path)) {
    return 'images/[name].[ext]?[hash]';
}

return 'images/vendor/' + path
    .replace(/\\/g, '/')
    .replace(
        /((.*(node_modules|bower_components))|images|image|img|assets)\//g, ''
    ) + '?[hash]';

Steps To Reproduce:

There is no support for this.

A new config variable could be added to move the files to a custom directory.

All 6 comments

I'd rather just stick with a common default for now.

+1 for the issue

Just ran into this situation. The website is located in a sub-directory, so it is absolutely necessary to add "/base/path/" before the generated paths.

+1

+1

+1

+1

Was this page helpful?
0 / 5 - 0 ratings