Webpack - 模块构建失败:函数sprite-map不支持关键字参数

时间:2017-01-13 13:40:43

标签: sass webpack compass

我是webpack的新手,我正在尝试在我的项目中实现它。我也在为我的.scss文件使用Compass。

我在我的入口点中包含了所有scss文件(请参阅下面的webpack配置),我有这个错误:

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

导致模块构建失败的scss文件:

$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;
}

但是查看 documentation ,可以使用关键字参数,不是吗?

这是我的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()
  ]
};

感谢您的帮助!

0 个答案:

没有答案