How to use the laravel-mix.config.preprocessors function in laravel-mix

To help you get started, we’ve selected a few laravel-mix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github podlove / podlove-publisher / webpack.config.js View on Github external
extensions.push('.ts', '.tsx')
}

let sassRule = {
    test: /\.s[ac]ss$/,
    loaders: ['style-loader', 'css-loader', 'sass-loader']
};

if (Mix.preprocessors) {
    sassRule.exclude = Mix.preprocessors.map(preprocessor => preprocessor.test());
}

rules.push(sassRule);

if (Mix.preprocessors) {
    Mix.preprocessors.forEach(preprocessor => {
        rules.push(preprocessor.rules());

        plugins.push(preprocessor.extractPlugin);
    });
}

module.exports.module = { rules };



/*
 |--------------------------------------------------------------------------
 | Resolve
 |--------------------------------------------------------------------------
 |
github theomessin / vue-chat-scroll / webpack.config.js View on Github external
},

        {
            test: /\.(woff2?|ttf|eot|svg|otf)$/,
            loader: 'file-loader',
            options: {
                name: 'fonts/[name].[ext]?[hash]',
                publicPath: '/'
            }
        }
    ]
};


if (Mix.preprocessors) {
    Mix.preprocessors.forEach(toCompile => {
        let extractPlugin = new plugins.ExtractTextPlugin(
            Mix.cssOutput(toCompile)
        );

        let sourceMap = Mix.sourcemaps ? '?sourceMap' : '';

        module.exports.module.rules.push({
            test: new RegExp(toCompile.src.path.replace(/\\/g, '\\\\') + '$'),
            loader: extractPlugin.extract({
                fallbackLoader: 'style-loader',
                loader: [
                    { loader: 'css-loader' + sourceMap },
                    { loader: 'postcss-loader' + sourceMap }
                ].concat(
                    toCompile.type == 'sass' ? [
                        { loader: 'resolve-url-loader' + sourceMap },
github theomessin / vue-chat-scroll / webpack.config.js View on Github external
}
        },

        {
            test: /\.(woff2?|ttf|eot|svg|otf)$/,
            loader: 'file-loader',
            options: {
                name: 'fonts/[name].[ext]?[hash]',
                publicPath: '/'
            }
        }
    ]
};


if (Mix.preprocessors) {
    Mix.preprocessors.forEach(toCompile => {
        let extractPlugin = new plugins.ExtractTextPlugin(
            Mix.cssOutput(toCompile)
        );

        let sourceMap = Mix.sourcemaps ? '?sourceMap' : '';

        module.exports.module.rules.push({
            test: new RegExp(toCompile.src.path.replace(/\\/g, '\\\\') + '$'),
            loader: extractPlugin.extract({
                fallbackLoader: 'style-loader',
                loader: [
                    { loader: 'css-loader' + sourceMap },
                    { loader: 'postcss-loader' + sourceMap }
                ].concat(
                    toCompile.type == 'sass' ? [
github someline / someline-starter / webpack.config.js View on Github external
},

        {
            test: /\.(cur|ani)$/,
            loader: 'file-loader',
            options: {
                name: '[name].[ext]?[hash]',
                publicPath: Mix.resourceRoot
            }
        }
    ]
};


if (Mix.preprocessors) {
    Mix.preprocessors.forEach(preprocessor => {
        module.exports.module.rules.push(preprocessor.rules());

        module.exports.plugins = (module.exports.plugins || []).concat(preprocessor.extractPlugin);
    });
}


/*
 |--------------------------------------------------------------------------
 | Resolve
 |--------------------------------------------------------------------------
 |
 | Here, we may set any options/aliases that affect Webpack's resolving
 | of modules. To begin, we will provide the necessary Vue alias to
 | load the Vue common library. You may delete this, if needed.
 |
github laraspace / laraspace-vue / webpack.config.js View on Github external
}
        },

        {
            test: /\.(woff2?|ttf|eot|svg|otf)$/,
            loader: 'file-loader',
            options: {
                name: 'fonts/[name].[ext]?[hash]',
                publicPath: '/'
            }
        }
    ]
};


if (Mix.preprocessors) {
    Mix.preprocessors.forEach(toCompile => {
        let extractPlugin = new plugins.ExtractTextPlugin(
            Mix.cssOutput(toCompile)
        );

        let sourceMap = Mix.sourcemaps ? '?sourceMap' : '';

        module.exports.module.rules.push({
            test: new RegExp(toCompile.src.path.replace(/\\/g, '\\\\') + '$'),
            loader: extractPlugin.extract({
                fallbackLoader: 'style-loader',
                loader: [
                    { loader: 'css-loader' + sourceMap },
                    { loader: 'postcss-loader' + sourceMap }
                ].concat(
                    toCompile.type == 'sass' ? [
github astralapp / astral / webpack.config.js View on Github external
},
            publicPath: Mix.options.resourceRoot
        }
    },

    {
        test: /\.(cur|ani)$/,
        loader: 'file-loader',
        options: {
            name: '[name].[ext]?[hash]',
            publicPath: Mix.options.resourceRoot
        }
    }
];

if (Mix.preprocessors) {
    Mix.preprocessors.forEach(preprocessor => {
        rules.push(preprocessor.rules());

        plugins.push(preprocessor.extractPlugin);
    });
}

module.exports.module = { rules }



/*
 |--------------------------------------------------------------------------
 | Resolve
 |--------------------------------------------------------------------------
 |
github laraspace / laraspace / webpack.config.js View on Github external
},

        {
            test: /\.(woff2?|ttf|eot|svg|otf)$/,
            loader: 'file-loader',
            options: {
                name: 'fonts/[name].[ext]?[hash]',
                publicPath: '/'
            }
        }
    ]
};


if (Mix.preprocessors) {
    Mix.preprocessors.forEach(toCompile => {
        let extractPlugin = new plugins.ExtractTextPlugin(
            Mix.cssOutput(toCompile)
        );

        let sourceMap = Mix.sourcemaps ? '?sourceMap' : '';

        module.exports.module.rules.push({
            test: new RegExp(toCompile.src.path.replace(/\\/g, '\\\\') + '$'),
            loader: extractPlugin.extract({
                fallbackLoader: 'style-loader',
                loader: [
                    { loader: 'css-loader' + sourceMap },
                    { loader: 'postcss-loader' + sourceMap }
                ].concat(
                    toCompile.type == 'sass' ? [
                        { loader: 'resolve-url-loader' + sourceMap },
github phppirate / attendant / webpack.config.js View on Github external
},
            publicPath: Mix.options.resourceRoot
        }
    },

    {
        test: /\.(cur|ani)$/,
        loader: 'file-loader',
        options: {
            name: '[name].[ext]?[hash]',
            publicPath: Mix.options.resourceRoot
        }
    }
];

if (Mix.preprocessors) {
    Mix.preprocessors.forEach(preprocessor => {
        rules.push(preprocessor.rules());

        plugins.push(preprocessor.extractPlugin);
    });
}

module.exports.module = { rules };



/*
 |--------------------------------------------------------------------------
 | Resolve
 |--------------------------------------------------------------------------
 |