Skip to content

Commit

Permalink
Fix icons not rendering (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylankelly authored Jul 2, 2019
1 parent aea4394 commit ea87937
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/ripple-nuxt-ui/lib/module.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const path = require('path')
const appDir = path.dirname(require.main.filename)

const resolve = path.resolve

// TODO: this need to be updated after published to npm.
const nuxtNodeModulesPath = '../../../node_modules/'

module.exports = function nuxtRipple (moduleOptions) {
const options = Object.assign({}, this.options.ripple, moduleOptions)

Expand All @@ -17,19 +15,21 @@ module.exports = function nuxtRipple (moduleOptions) {

this.extendBuild((config, { isServer }) => {
// Exclude svg from url-loader - it conflicts with 'svg-sprite-loader'.
const rippleIconPath = path.dirname(require.resolve('@dpc-sdp/ripple-icon/package.json'))

const urlLoader = config.module.rules.find((rule) => rule.use && rule.use.find(r => r.loader === 'url-loader'))
if (urlLoader) {
urlLoader.exclude = [
resolve(__dirname, nuxtNodeModulesPath + '@dpc-sdp/ripple-icon/'),
resolve(__dirname, '../../../assets/ripple-icon/')
resolve(__dirname, rippleIconPath),
resolve(__dirname, `${appDir}/assets/ripple-icon/`)
]
}
// Add svg-sprite-loader to create svg sprite
config.module.rules.push({
test: /\.svg$/,
include: [
resolve(__dirname, nuxtNodeModulesPath + '@dpc-sdp/ripple-icon/'),
resolve(__dirname, '../../../assets/ripple-icon/')
resolve(__dirname, rippleIconPath),
resolve(__dirname, `${appDir}/assets/ripple-icon/`)
],
use: [
'svg-sprite-loader',
Expand Down

0 comments on commit ea87937

Please sign in to comment.