Use file-loader to import icon sprites
This commit is contained in:
parent
7064d48e2b
commit
7d68ac70aa
2 changed files with 11 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
|
import iconsPath from '@gitlab/svgs/dist/icons.svg';
|
||||||
|
|
||||||
// only allow classes in images.scss e.g. s12
|
// only allow classes in images.scss e.g. s12
|
||||||
const validSizes = [8, 10, 12, 14, 16, 18, 24, 32, 48, 72];
|
const validSizes = [8, 10, 12, 14, 16, 18, 24, 32, 48, 72];
|
||||||
let iconValidator = () => true;
|
let iconValidator = () => true;
|
||||||
|
@ -84,7 +86,7 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
spriteHref() {
|
spriteHref() {
|
||||||
return `${gon.sprite_icons}#${this.name}`;
|
return `${iconsPath}#${this.name}`;
|
||||||
},
|
},
|
||||||
iconTestClass() {
|
iconTestClass() {
|
||||||
return `ic-${this.name}`;
|
return `ic-${this.name}`;
|
||||||
|
|
|
@ -156,8 +156,16 @@ module.exports = {
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'graphql-tag/loader',
|
loader: 'graphql-tag/loader',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /icons\.svg$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: '[name].[hash:8].[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
|
exclude: /icons\.svg$/,
|
||||||
loader: 'raw-loader',
|
loader: 'raw-loader',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue