How to use Sass Eyeglass with Webpack?

老子叫甜甜 提交于 2019-12-10 11:10:17

问题


I would like to use Sass Eyeglass with Webpack. I have found very little information about it and is rather frustrating because I'm sure it can be done.

Has anyone had any success using it?


回答1:


I managed to get eyeglass working with sass-loader in recent webpack.

Eyeglass injects its own options for sass which you can in turn pass as options to sass-loader:

[...]
{
    test: /\.scss$/,
    include: config.paths.assets,
    use: ExtractTextPlugin.extract({
      fallback: 'style',
      publicPath: '../',
      use: [
        `css?${sourceMapQueryStr}`,
        'postcss',
        `resolve-url?${sourceMapQueryStr}`,
        {
          loader: `sass?${sourceMapQueryStr}`,
          options: eyeglass({
              // sass options...
              includePaths: ['/share/scss/'],
              eyeglass: {
                // eyeglass options
              }
            })
        }
      ],
    }),
 },
 [...]


来源:https://stackoverflow.com/questions/40696767/how-to-use-sass-eyeglass-with-webpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!