4

I am new to webpack and I'm trying to implement it in my project. I'm also using Compass for my .scss files.

I included all my scss files in my entrypoint (see the webpack configuration down below) and I have this error:

Error line 1: Function sprite-map doesn't support keyword arguments

The scss file that causes the module build to fail:

$icons: sprite-map("icons/icons-1/k/*.png", $spacing: 10px);

@each $i in sprite_names($icons) {
  .k-#{$i}{
    background-position: sprite-position($icons, $i, 0, 0, true);
  }
}

.k-121, .k-122, .k-123, .k-124, .k-125, .k-126, .k-127, .k-128, .k-129, .k-130, .k-131, .k-132, .k-133,  {
  background-image: $icons;
  background-repeat: no-repeat;
}

But looking at the documentation, it is possible to use keyword arguments, isn't it ?


Here is my webpack.config.js :

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: path.resolve(__dirname, 'scripts/app.js'),
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.s?css$/,
        loaders: 'sass-loader'
      },
      {
        test: /\.jsx?$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/, 
        loader: 'file-loader?name=/dist/img/[name].[ext]'
      },
      {
        test: /\.(eot|otf|ttf|woff|woff2)$/,
        loader: 'file-loader?name=dist/fonts/[name].[ext]'
      }
    ]
  },
  devtool: 'source-map',
  plugins: [
    new HtmlWebpackPlugin()
  ]
};

Thanks for your help !

Val Berthe
  • 1,899
  • 1
  • 18
  • 33

0 Answers0