问题
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