Reputation: 2048
There is many shortcuts in webpack config: [name]
, [path]
... any loader can provide his own (e.g css-loader provides [local]
shortcut).
How can I get file directory (the last in the chain) for the [path]
?
Here is my config:
{
test: /\.css$/,
loaders: [
'style',
'css?localIdentName=[path]', // Path - full chain, but I need only the last dir
],
}
[path
] here is, for example, src-components-button, but I need only the last - button.
Upvotes: 0
Views: 1508
Reputation: 36
You can use following code:
'css?localIdentName=[folder]' https://github.com/webpack/loader-utils#interpolatename
As sample for cssModules name:
'style!css?localIdentName=[folder][local][hash:base64:5]'
This issue is discussed in the topic:https://github.com/webpack/css-loader/issues/101
Upvotes: 2