A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/webpack-contrib/less-loader/issues/85 below:

problem with resolve relative path witch LESS function · Issue #85 · webpack-contrib/less-loader · GitHub

in the folder /app/el/ exsist file logo.png
./app/el/btn.less

@import (reference) "~app/mixin/sprite.less";
.btn {
    .sprite('./logo.png');
}

./app/mixin/sprite.less

.sprite(@file, @spriteName: 'sprite') {
    width: image-width(@file);
    height: image-height(@file);
    background: url("@{file}#@{spriteName}");
}

error:

    ERROR in ./~/css-loader?sourceMap!./~/postcss-loader?sourceMap!./~/less-loader?sourceMap!./app/el/btn.less
    Module build failed: error evaluating function `image-width`: './logo.png' wasn't found. Tried - /Users/DragorWW/test-app/app/mixin/logo.png,logo.png

if not use mixin in ./app/el/btn.less, all is well.

.btn {
    width: image-width('./logo.png');
    height: image-height('./logo.png');
    background: url('./logo.png');
}

webpack.config.js

module.exports = {
    context: path.join(__dirname, 'app'),
    module: {
        loaders: [
            {
                test: /\.less$/,
                loader: ExtractTextPlugin.extract('style','css?sourceMap!postcss?sourceMap!less?sourceMap')
            },
            {
                test: /\.(jpe?g|png|gif|svg)$/i,
                loaders: [
                    'url?limit=5000&name=images/[name]-[hash:6].[ext]'
                ]
            },
        ]
    },
    resolve: {
        alias: {
            app: path.join(__dirname, '/app')
        },
    },
    plugins: [
        new ExtractTextPlugin('styles.css'),

    ],
};

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4