2016-11-16 07:04:57 +00:00
|
|
|
import loaderUtils from 'loader-utils'
|
2016-10-15 16:17:27 +00:00
|
|
|
|
|
|
|
module.exports = function (content) {
|
|
|
|
this.cacheable()
|
|
|
|
|
2016-11-16 07:04:57 +00:00
|
|
|
const query = loaderUtils.parseQuery(this.query)
|
2016-10-15 16:17:27 +00:00
|
|
|
const name = query.name || '[hash].[ext]'
|
|
|
|
const context = query.context || this.options.context
|
|
|
|
const regExp = query.regExp
|
|
|
|
const opts = { context, content, regExp }
|
2016-11-16 07:04:57 +00:00
|
|
|
const interpolatedName = loaderUtils.interpolateName(this, name, opts)
|
2016-10-15 16:17:27 +00:00
|
|
|
|
|
|
|
this.emitFile(interpolatedName, content)
|
|
|
|
|
|
|
|
return content
|
|
|
|
}
|